What is the difference between parameters and arguments in JavaScript?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which of the following statements is true regarding JavaScript functions?
What is the purpose of the 'return' statement in JavaScript functions?
What will be the output of the following code?
function greet() {
console.log("Hello!");
}
console.log(typeof greet);
What will be the output of the following code?
function sum(a, b) {
return a + b;
}
var result = sum(3, 4);
console.log(result);
What will be the output of the following code?
function outer() {
var x = 10;
function inner() {
console.log(x);
}
return inner;
}
var fn = outer();
fn();
What will be the output of the following code?
var x = 5;
function test() {
console.log(x);
var x = 10;
}
test();
What will be the output of the following code?
function multiply(a, b = 2) {
return a * b;
}
console.log(multiply(3));
What will be the output of the following code?
var x = 10;
function outer() {
function inner() {
console.log(x);
}
inner();
var x = 20;
}
outer();
What will be the output of the following code?
function greet(name) {
console.log("Hello, " + name + "!");
}
greet();
What will be the output of the following code?
function outer() {
var x = 10;
function inner() {
console.log(x);
}
x = 20;
return inner;
}
var fn = outer();
fn();
What will be the output of the following code?
var x = 10;
function test() {
if (x === 10) {
var x = 20;
}
console.log(x);
}
test();
What will be the output of the following code?
function add(a, b) {
return a + b;
}
function multiply(a, b) {
return a * b;
}
var result = add(2, multiply(3, 4));
console.log(result);
51 videos|28 docs|12 tests
|
51 videos|28 docs|12 tests
|