Javascript interview fun snippets
Mar 27, 2022
Q1. Guess the output:
const obj = {
prop: 42
};
Object.freeze(obj);
obj.prop = 33;console.log(obj.prop);
Take your time, don’t jump into a solution think hard
Output:
42
Q2.Guess the output
let obj1 ={name:”vineet”}
let obj2 ={name:”vineet”}
console.log(obj1===obj2);
console.log(JSON.stringify(obj1)===JSON.stringify(obj2));
console.log(obj1==obj2);
console.log(JSON.stringify(obj1)==JSON.stringify(obj2));
Take your time, don’t jump into a solution think hard
Output:
false
true
false
true