Question d’entretien chez Amazon

1)write a plugin like query on the paper 2)write a data structure queue program in javascript on the paper 3)given 2 objects var obj1 = { name: "abc"; }; var obj2 = { age: 25 }; do the interitance; 4)lets have ()[]{} pattern should have open and close inorder; example a{abc()}[]//write a funtion to return true; example a{a[bc}//write a funtion to return false; 5)function Test(){ for(var i=0; i<10;i++){ setTimeout[function(){ console.log(i); },0); } } Test(); //I have told the answer (i.e will display 10 in 10 times) But they have asked me to print the 1 to 10 with same code 5) add(2)(5)(3);//output should be 10

Réponse à la question d'entretien

Utilisateur anonyme

9 avr. 2017

5)add(2)(5)(3);//output should be 10 below is the solution ES6 Syntax: let add = (a, b,c) => a + b + c; console.log(add(2, 5,3)); // output: 10 const add2 = a => b => c=> a + b +c; console.log(add2(2)(5)(3)); // output: 10