WorksheetsJS Quiz
Total questions: 14
Worksheet time: 11mins
Which of the following is wrong?
var greeting = `\`Yo\` World!`;
//output - `Yo` World!
var user = {name: 'World'};
console.log(`Thanks for getting this into V8, ${user.name.toUpperCase()}.`);
//output - Thanks for getting this into V8, WORLD.
console.log("string text line 1 \ string text line 2");
I want to extract 'hello' and 'array' from the array using destructuring
var [greeting,name] = ["Hello", "I" , "am", "Array"];
var [greeting,,,name] =
["Hello", "I" , "am", "Array"];
var array = ["Hello", "I" , "am", "Array"];
greeting = array[0];
name = array[2];
Select all the correct options.
var[greeting = "hi", name = “Array"] = ["hello"];
let person = {name: "Object", country: "India", job: "Developer"};
let {name = "Name", company = "Epsilon"} = person;
const message = `Some weird characters: \${abc}`;
var a = 10;
var b = 5;
var result = `The sum of ${a} and ${b} is ${a + b} difference is ${a-b}`;
A function with a provided this and further arguments are provided as a comma separated list
Apply
Call
Bind
On
Returns a new function whose this value is bound to the provided value.
Call
Apply
Bind
Bound
Calls a function with a provided this value. Further arguments are provided as a single array
(a)
Bind executes the function it was called upon right away
True
False
[a, b, ...rest] = [10, 20, 30, 40, 50];
console.log(rest);
50
[30, 40, 50]
[10, 20]
let a, b;
[a=5, b=7] = [1];
console.log(a);
console.log(b)
1 7
5 7
1 1
5 1
let a = 1;
let b = 3;
[a, b] = [b, a];
console.log(a);
1
3
const arr = [1,2,3];
[arr[2], arr[1]] = [arr[1], arr[2]];
console.log(arr);
[3,1,2]
[1,3,2]
[1,2,3]
const o = {p: 42, q: true};
const {p: foo, q: bar} = o;
console.log(foo);
undefined
42
p
var func = function() {
console.log(this)
}.bind(1);
func();
Number {1}
1
window
function checkFun(a, b, c){
console.log(this);
console.log(a);
console.log(b);
console.log(c);
}
checkFun.apply(1,[2,3,4]);
1
2
3
4
[Number: 1]
2
3
4
this
2
3
4
