Created
February 15, 2022 08:51
-
-
Save asifsaho/5dfcbfebfc83eadc413869fd293159c4 to your computer and use it in GitHub Desktop.
JS interview question
This file contains 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
console.log(add(5, 7)) // 12 | |
console.log(add(5)(7)) // 12 | |
console.log(add(3)(7)) // 10 | |
function greet(greeting, punctuation) { | |
return greeting + ' ' + this.user + punctuation; | |
} | |
const freddy = { user: 'fred' }; | |
console.log(greet.bind(freddy, 'hi')('!')); // 'hi fred!' | |
const asif= { | |
greet: function () { | |
function sayHi(this) { | |
console.log(`Hi ${this.name}`); | |
} | |
sayHi(); | |
}, | |
name: "Asif", | |
}; | |
asif.greet() | |
const obj = {} console.log('obj' in obj); console.log('toString' in obj); console.log('toNumber' in obj); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment