Node.js is a server-side JavaScript runtime environment, while JavaScript is a client-side scripting language.

Node.js Example:

var http = require(‘http’);

http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Hello Worldn’);
}).listen(8080);

JavaScript Example:

document.getElementById(“myBtn”).addEventListener(“click”, function(){
document.getElementById(“demo”).innerHTML = “Hello World”;
});

Leave a Reply

Your email address will not be published. Required fields are marked *