This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr1 = [1, 2, 4, 5]; | |
let arr2 = arr1; | |
arr1.length = 0; | |
console.log(arr2); // Output :- [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr1 = [1, 2, 4, 5]; | |
let arr2 = arr1; | |
arr1 = []; | |
console.log(arr2); | |
// -> Output [1, 2, 4, 5]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr1 = [1, 2, 4, 5]; | |
let arr2 = array1; | |
arr1 = []; | |
console.log(arr2); | |
// -> Output [1, 2, 4, 5]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr = [ | |
{ | |
firstName: 'Jon', | |
lastName: 'Doe' | |
}, | |
{ | |
firstName: 'example', | |
lastName: 'example' | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sym1 = Symbol(); | |
const sym2 = Symbol(); | |
sym1 === sym2; | |
// false | |
const sym3 = Symbol.for("cat"); | |
const sym4 = Symbol.for("cat"); | |
sym3 === sym4; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const fs = require('fs'); | |
// All the routes are defined here. | |
const router = [ | |
{ | |
'url': '/', | |
'fn': (req, res) => { | |
res.writeHead(200, { 'Content-Type': 'text/html' }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const PORT = process.env.PORT || 5000; | |
const app = http.createServer((req, res) => { | |
res.writeHead(200, { 'Content-Type': 'text/html' }); | |
res.write("Hello World"); | |
res.end(); | |
}); |