Exam in
34 questions
Consider you have a function "funcX" that multiplies any input number by 3. And you have a list of numbers Y=[1,3,4]. The result of the statement Y.map(funcX) is
If you have the following JavaScript statement: const f = (a,b)=>a+b+5;
To select numbers that are less than 10 from an array of numbers (named myNumbers), the following is a correct syntax to do it:
In the following function:
function multiply(...myNumbers) {
let total = 1
for (let myNumber of myNumbers) total *= myNumber;
return total; }
The "..." will:
The "..." in the previous question are called:
Which is the correct syntax to declare a constant in JavaScript?
What will be the output of this code?
const VALUE=10;
VALUE=20;
What will be the value of X printed?
var X=10;
function myfunc() {
let x=20;
document.write(X);
}
What will be the output of the following JavaScript code?
var numbers = [1, 2, 3, 4];
function myfunc(total, value) {
return total + value;
var sum = numbers.reduce(myfunc, 2);
document.write(sum);
What will be the output of this JavaScript code?
var numbers = [10, 20, 10, 30];
var y = numbers.lastIndexOf(10);
var z = numbers.indexOf(30);
document.write(y + z);
var numbers = [170, 50, 25];
return total - value;
var x = numbers.reduce(myfunc);
document.write(x);
const arr = [10, 20, 30];
let result = 0;
arr.forEach(myFunction);
document.write("Result: ", result);
function myFunction(value, index, array) {
result + value;
const values = [10, 20, 30];
const result = values.map(myFunction);
return value * value;
Which function is used to serialize an object into a JSON string in JavaScript?
var x = [10, 20, 30];
return value > 10;
var y = x.find(myFunction);
document.write(y);
try {
const cars = {
company: "Honda",
color: "white"
};
var x = "color";
delete cars.company;
document.write(cars.company);
document.write(cars[x]);
} catch (err) {
document.write(err.message);
var numbers = [10, 20, 30];
var y = numbers.filter(myFunction);
document.write(typeof(y));
What will be the output of the following JavaScript code snippet?
function test(...args) {
document.write(typeof(args));
test(12);
var quiz = [1, 2, 3];
var result = quiz.concat(6, 7, 8);
document.write(result);
If you have the following JavaScript statement: const f = (a, b) a + b + 5;
To multiply an array of numbers (named myNumbers) with 4, the following is a correct syntax to do it:
To select items that are less than 10 from an array of numbers (named myNumbers), the following is a correct syntax to do it:
const myArr = [1, 2, [3, [4, 5, 6], 7], 8];
const newArr = myArr.flat();
document.writeln(newArr);
const myArr =[1,2, [3, [4, 5, 6, 7], 8]];
const newArr = myArr.flat (2);
console.log(newArr);
AJAX is used for refreshing the page content by sending a request to the server and updating the whole HTML page from the response.
What does 'use strict' do in JavaScript?
What is the result of running the following code in strict mode?
x=10;
console.log(x);
What is the difference between var, let, and const?
In JavaScript, which of the following is a valid getter in an object?
In JavaScript, What is the purpose of the constructor method in a class?
In JavaScript, What does the super keyword do?
How many ways are there with which we can declare a variable in javascript?
Which method can be used to combine two arrays in JavaScript?
Consider the following async function and its output. What will be displayed to the console when calling the f() function?
async function f() {
let promise = new Promise((resolve, reject) => {
console.log('first!');
setTimeout(() => resolve('done!'), 1000);
});
let result = await promise;
console.log(result);
f();