NodeJs makes this task extremely simple using the net package. Of course there are port scanning packages available on npm that make this task much easier but I'm a developer and I like to write my own code.
Listing 1
var net = require('net');
async function scan(){
        
    let host = "127.0.0.1";
    let start = 80;
    let stop = 65000;
    
    for(let port = start; port <= stop; port++){
        try{
            await connect(host, port);
            console.log(`Port ${port} open`);
        }catch(e){
            // Do nothing
        }
    }
    console.log('Scan complete');
}
async function connect(host, port){
    return new Promise((res, rej) => {
        net.connect({host : host, port: port}, () => {
           res(true);
        }).on("error", err => {
            rej(err);
        });
    });
}
scan();
- 
                                            A JavaScript Implementation Of The Logo Programming Language - Part 2
                                            Part 2 of A Javascript Implementation Of The Logo Programming Language. In the previous article I explained how to develop a simple lexer. In this part we develop a TokenCollection class to help traverse the array of tokens returned from the lexer. 10 June 2020 - 3523 views
- 
                                            A JavaScript Implementation Of The Logo Programming Language - Part 1
                                            In this four part article, I explain how to develop the iconic Logo programming language in JavaScript. In this part, we discuss how to take a source input and convert it into a series of tokens. 06 June 2020 - 6050 views
- 
                                            Generating Web API Keys
                                            If you're building a REST API, chances are you're going to need to generate secure random API keys. In this article, I explain how to use the Node.js crypto module to generate random secure API keys. 29 May 2020 - 9052 views
- 
                                            Sorting Algorithms
                                            An introduction to sorting algorithms. 29 November 2019 - 3118 views
- 
                                            Simple Http Server
                                            This article explains how to create a simple HTTP server using Node.js without using any dependencies. 04 September 2019 - 2881 views
- 
                                            Reading From Console
                                            Node.Js provides several ways to read user input from the terminal. This article explains how to use the process object to read user input. 16 July 2019 - 3540 views
- 
                                            Difference Between const, let And var
                                            This article explains the difference between const, let and var. 12 July 2019 - 2649 views
