practical questions asked in the intrvew in the capgemni
http://centraljs.girnarsoft.com/codeshare#FxtS0
.............................................................................................................
/* FIrst */
const array = [];
array.push(1);
array.push(2);
array.push(3);
array[0] = 24;
array = true;
let array = [];
array.push(1);
array.push(2);
array.push(3);
array[0] = 24;
array = true;
/* Hoisting */
console.log(square(2));
const square = (x) => x*x;
console.log(square(2));
var square = (x) => x*x;
console.log(square(2));
function square(x){
return x*x
};
/* Operators */
console.log(undefined && true)
console.log(true && undefined)
console.log(true || undefined)
console.log(undefined || true)
/* Prototyping */
const a = { x : 1};
const b = Object.create(a);
console.log(b);1
delete b.x;
console.log(a);1
console.log(b);1
/* This */
/* context based */
function bike() {
console.log(this.name);
}
var name = "Ninja";
var obj1 = { name: "Pulsar", bike: bike };
var obj2 = { name: "Gixxer", bike: bike };
bike();ninja
obj1.bike();ninja
const square = (x) => {
return x * x;
}
const square = (x) => x*x ;
Comments
Post a Comment