diff --git a/Q11.js b/Q11.js new file mode 100644 index 0000000..843fb75 --- /dev/null +++ b/Q11.js @@ -0,0 +1,25 @@ +/** + * what will be the output of the following code? + */ + +/** Q1 */ + +console.log(0.1 + 0.2 == 0.3); +console.log(0.1 + 0.2 === 0.3); + +console.log([] === []); + +console.log({} === {}); + +var person = { + name:"ravi", + greet: function(){ + return "Hello " + this.name; + } +} + +var greetFn = person.greet; + +console.log(greetFn()); + +console.log(person.greet()); \ No newline at end of file diff --git a/Q12.js b/Q12.js new file mode 100644 index 0000000..8565acb --- /dev/null +++ b/Q12.js @@ -0,0 +1,11 @@ +/** + * write a function to find missing numbers in an array in sequence 0-10 + */ + +var arr = [1, 2, 4, 6, 9]; + +for (let i = 1; i <= 10; i++) { + if (!arr.includes(i)) { + console.log(i); + } +}