Questions Bank In the following code fragment, where we use setInterval, one line is missing – the place is marked in gray: let counter = 2; let interval = setInterval(() => { console.log(counter); }, 1000); What should the missing line look like if the execution of this code results in the console displaying the values 2, 1, and 0 in sequence?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Select a set of data types, containing only complex types:OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Analyze the following code: for (let a = 5; a > 2; a–) { console.log(a); }; Which statement can replace the for from the example?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Entering about:blank in the address bar of your browser will:OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Analyze the following code: let id = “100”; { let id = 200; id = id + 1; console.log(id); } What will appear to the console as a result?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Analyze the following code: let test = prompt(“Run”, “code”); What value will the test variable have if, after running the code, we immediately press the OK button on the newly created dialog?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Analyze the following code: let route = {distance: 131, elevation: 1.4}; for (let k in route) console.log(k); What will appear on the console as a result?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Analyze the following code: function execute(todo, a, b) { return todo(a, b); } console.log(execute(power, 3, 2)); Before declaring the function, we should add one more line of code. Which one, if the execution of the completed code will result in the console displaying the value 9?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Which of the following loop instructions checks the loop continuation condition only after the iteration has been completed?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1The temp array contains air temperature data measured over a period of time. We want to display the minimal temperature, and to do so we write the following code: temp.forEach(e => min = min > e ? e : min); console.log(min); In the code, we use the variable sum, which should be previously declared as follows:OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Analyze the code snippet: let counter = 0; let userName = “John”; After declaring the counter variable, we want to add a short comment with information about what the variable is used for. To do this, we modify the line with the declaration to the form:OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1We define a function using a function expression: let sum = function (a, b) { return (a + b); } What could the definition of the corresponding arrow function look like?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Examine the following code: x = [40, 10, 30, 20, 50]; x.sort(cmp); How should the function cmp be declared if, after the code execution, the elements of the array x are sorted in ascending order?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1The JavaScript code includes the console.log(“http://somethingNew.org”); command. Its execution will:OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1Examine the following code: let a = 20 + “10”; let b = 20 + +”10″; let c = 20 + -“10” + “10”; let d = “10” – “10” + “100”; let e = “A” – “B” + 0xA; console.log(‘${a}, ${b}, ${c}, ${d}, ${e}’); What will appear on the console as a result?OpenProgrammingAnswers asked 2 years ago • JavaScript Essentials 1