- What will be printed to the console?
let a = 10;
a.b = 10;
console.log(a);
Output
10- What storages do save data after closing the browser? (
LocalStorage
,CookieStorage
,SessionStorage
) -
Promise.reject('a') .catch(p => p + 'b') .catch(p => p + 'c') .then(p => p + 'd') .finally(p => p + 'e') .then(p => console.log(p))
Output
abd-
What is the function's
[[Scope]]
property equal to?- Current Lexical Environment
- Current Lexical Environment or window
- Function doesn't have such property
- Lexical Environment in which this function was called
-
What is
HTMLCollection
?- An object with numeric keys containing DOM elements and provides additional methods for working with the collection
- Array of DOM elements
- Array of DOM elements, that has additional methods to work with this collection
- An object with numeric keys containing DOM elements and provides methods for working with them like with an array
-
What will be printed to the console?
var a = 'hello';
function b() {
if (false) {
var a = 'world';
} else {
var b = 'man';
}
console.log(b);
console.log(a);
}
b();
Output
man, undefined- What will be printed to the console?
const map = new Map();
map.set('0', '1');
map.set('s2', '2s');
map.set('3s', 's3');
const arr = [...map.values()];
const result = arr.map(value => parseInt(value, 10));
console.log(result);
Output
[1, 2, NaN]- What will be printed to the console?
var x = 10
function bar(funArg) {
var x = 30;
funArg();
}
function foo() {
console.log(x)
}
foo.x = 20;
bar.x = 40;
bar(foo);
Output
10- What will be printed to the console?
var obj = {
a: () => {
console.log(this.prop);
},
prop: 1
};
obj.a();
var fn = obj.a.bind(obj);
fn();
Output
undefined, undefined- What will be printed to the console if we click three times?
class GODListener {
constructor() {
this.counter = 0;
}
handleClick() {
this.counter += 1;
console.log(this.counter);
}
}
const element = document.getElementById('testBtn');
const listener = new GODListener();
element.addEventListener('click', listener.handleClick);
Output
NaN, NaN, NaN- What will be printed to the console?
var a = {};
(function b(a) {
a.a = 10;
a = null;
})(a);
console.log(a);
Output
{ a: 10 }- What will be printed to the console?
console.log(0 || 200);
console.log(0 ?? 400);
console.log(0 && 600);
Output
200 0 0- What is the return type of this function?
async function Fn() {
if (await CheckUser()) {
return 42;
}
return undefined;
}
Output
Promise<42 | undefined>- What will be printed to the console?
console.log(null == undefined);
console.log(null === undefined);