Signup/Sign In

Using 'use strict' Directive in JavaScript Code Test

JavaScript Avg. Score: 0.74 226 Intermediate
Q.1 What will be the output of the following code:
function sum(...a) {
    "use strict";
    return a[0].reduce((s, val) => s = s + val, 0);
}

console.log(sum([1,2,3,4]))

 

Q.2 What will happen when you run the following code:
"use strict";

let someVariable;
somVariable = 17;

 

Q.3 What will be the output of the following code:
function sum(a, a, c) {
    return a + a + c;
}

console.log(sum(10, 20, 30))

 

Q.4 What will be the output of the following code:
"use strict";

const obj = { id: 1, id: 2 };

console.log(obj)

 

Q.5 What will be the output of the code in strict mode and non strict mode:
var x = 7;
delete x;
console.log(x);

 


Studytonight logo

Find me on YouTube

I make videos for Fullstack Dev, AWS, Ethical Hacking and Foundational stuff.