Skip to content

Latest commit

 

History

History
616 lines (580 loc) · 19.5 KB

File metadata and controls

616 lines (580 loc) · 19.5 KB
chooseOptions
data
questionTitle questionDescription answers correctAnswer explanation complexity theme
Кто является основным создателем языка Java Script?
Бил Гейтс
Линус Торвальдс
Джеймс Гослинг
Брендан Эйх
Брендан Эйх
1
Общие сведения
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какую строку выведет console.log?
var a='1';
var b = 1;
res = (a == b) + ',' + (a === b);
console.log(res);)
false, false
true, true
false, true
true, false
true, false
1
Приведение типов
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какое значение будет выведено в консоли?
result = 0;
function addValue(x) {
result = result + x;
return result;
}
console.log(addValue(addValue(10)));)
30
10
20
0
20
1
Всплытие переменных
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какое значение будет выведено в консоли?
var output = (function(x) {
delete x;
return x;
})(0);
console.log(output);
undefined
0
{}
ошибка
0
1
Объекты
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какое значение будет выведено в консоли?
var x = 1;
var output = (function(x) {
delete x;
return x;
})();
console.log(output);
undefined
0
1
ошибка
1
1
Объекты
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какое значение будет выведено в консоли?
var x = { foo : 1}
var output = (function(x) {
delete x.foo;
return x.foo;
})();
console.log(output);
undefined
0
{}
ошибка
undefined
1
Объекты
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какое значение будет выведено в консоли?
var Employee = {
company: 'xyz'
}
var emp1 = Object.create(Employee);
delete emp1.company
console.log(emp1.company);
undefined
xyz
null
ошибка
xyz
2
Объекты
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какое значение будет выведено в консоли?
var trees = ['xyz', 'xxxx', 'test', 'ryan', 'apple'];
delete trees[3];
console.log(trees.length);
5
4
undefined
6
5
2
Массивы
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какое значение будет выведено в консоли?
var bar = true;
console.log(bar + 0);
console.log(bar + 'xyz');
console.log(bar + true);
console.log(bar + false);
'10', 'truexyz', 'truetrue', 'truefalse'
1, 2, 2, 1
'1', 'truexyz', '11', 1
1, 'truexyz', 2, 1
1, 'truexyz', 2, 1
1
Приведение типов
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какое значение будет выведено в консоли?
var z = 1, y = z = typeof y;
console.log(y);
'undefined'
1
undefined
NaN
'undefined'
3
Операторы
questionTitle questionDescription answers correctAnswer explanation complexity theme
Что вернет метод fill?
[1,2.3,4,5,6].fil(0,2,3)
[0,2,3,4,5,6]
[1,2,0,4,5,6]
[1,2,3,0,5,6]
[1,2,0,0,0,0]
[1,2,0,4,5,6]
1
Массивы
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой из методов массива удалит и вернет первый элемент массива?
pop()
shift()
unshift()
push()
shift()
1
Массивы
questionTitle questionDescription answers correctAnswer explanation complexity theme
Number в JS по умолчанию хранятся в:
64 бита
32 бита
16 бит
8 бит
64 бита
1
Типы данных
questionTitle questionDescription answers correctAnswer explanation complexity theme
Что выведет в консоль?
const x = null || 0 || {name: false};
console.log(x);
0
undefined
null
{name: false}
{name: false}
1
Типы данных
questionTitle questionDescription answers correctAnswer explanation complexity theme
Что выведет в консоль?
var scope = "global";
function outer() {
function scope() {
console.log(scope);
}
scope();
}
outer();
global
object window
ReferenceError
тело функции scope
тело функции scope
2
Scope
questionTitle questionDescription answers correctAnswer explanation complexity theme
Что выведет в консоль?
var b = 1;
function outer() {
var b = 2
function inner() {
b++;
var b = 3;
console.log(b);
}
inner();
}
outer();
undefined
NaN
2
3
4
3
2
Scope
questionTitle questionDescription answers correctAnswer explanation complexity theme
Что выведет в консоль?
function () {
try {
throw new Error();
} catch (x) {
var x = 1, y = 2;
console.log(x);
}
console.log(x);
console.log(y);
})();
1, undefined, 2
1, 1, 2
1, undefined, undefined
1, undefined, 2
3
Scope
questionTitle questionDescription answers correctAnswer explanation complexity theme
Что выведет в консоль?
(function(x) {
return (function(y) {
console.log(x);
})(2)
})(1);
undefined
2
1
ReferenceError
1
1
Замыкание
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат выполнения?
(function() {
return typeof arguments;
})();
undefined
object
array
arguments
object
2
Функции
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат выполнения?
var f = function g() {
return 23;
};
typeof g();
undefined
function
number
ReferenceError
ReferenceError
2
Функции
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат выполнения?
var f = function g() {
return 23;
};
concole.log(typeof g);
undefined
function
number
ReferenceError
undefined
2
Функции
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат выполнения?
(function(a) {
arguments[0] = 10;
return a;
})(5);
5
10
undefined
ReferenceError
10
3
Функции
questionTitle questionDescription answers correctAnswer explanation complexity theme
Что выведет в консоль?
var obj = {
a: 1
};
(function(obj) {
obj = {
a: 2
};
})(obj);
1
2
undefined
ReferenceError
1
3
Функции
questionTitle questionDescription answers correctAnswer explanation complexity theme
С помощью какого метода объекта события можно отменить стандартное поведение браузера?
cancelEvents()
preventEvent()
preventDefault()
stopPropagation()
preventDefault()
1
События
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат выполнения?
function Car(color) {
this.color = color;
}
var lada = new Car("Black");
Car.prototype.currentGear = 1;
console.log(++lada.currentGear);
console.log(Car.prototype.currentGear);
1, 2
2, 1
1, 1
2, 2
2, 1
2
Объекты
questionTitle questionDescription answers correctAnswer explanation complexity theme
В каком порядке выводятся значения в консоль?
(function() {
console.log(1);
setTimeout(function(){console.log(2)}, 1000);
setTimeout(function(){console.log(3)}, 0);
console.log(4);
})();
1, 2, 3, 4
1, 3, 2, 4
1, 4, 2, 3
1, 4, 3, 2
1, 4, 3, 2
3
События
questionTitle questionDescription answers correctAnswer explanation complexity theme
В чем особенность событий focus/blur?
у них нет объекта события
они не всплывают
можно назначить только один обработчик событий
нельзя отменить действия браузера по умолчанию
они не всплывают
2
События
questionTitle questionDescription answers correctAnswer explanation complexity theme
В какой момент времени определяется значение this для метода?
при создании объекта
при каждом вызове метода
в момент первого вызова метода
при создании метода
при каждом вызове метода
2
Объекты
questionTitle questionDescription answers correctAnswer explanation complexity theme
В каком порядке выведутся значения в консоль?
(function() {
console.log(1);
setTimeout(() => console.log(2), 1000);
setTimeout(() => console.log(3), 0);
Promise.resolve(true).then(() => console.log(4));
console.log(5);
})();
1, 2, 3, 4, 5
1, 5, 3, 2, 4
1, 3, 5, 2, 4
1, 5, 4, 3, 2
1, 5, 4, 3, 2
3
События
questionTitle questionDescription answers correctAnswer explanation complexity theme
В каком порядке выведутся значения в консоль?
let promise = new Promise((resolve, reject) => {
console.log(1);
resolve(2);
});
promise.then(res => console.log(res));
console.log(3);
1, 2, 3
3, 1, 2
1, 3, 2
3, 2, 1
1, 3, 2
3
События
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат выполнения?
function test() {
console.log(a);
console.log(foo());
var a = 1;
function foo() {
return 2;
}
}
test();
undefined, undefined
undefined, 2
1, 2
undefined, function foo()
undefined, function foo()
2
Всплытие
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат выполнения?
function doSomething() {
console.log(bar);
console.log(foo);
var bar = 1;
let foo = 2;
}
undefined, undefined
undefined, ReferenceError
1, undefined
1, 2
undefined, ReferenceError
2
Всплытие
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат фызова функции?
function varTest() {
var x = 1;
if (true) {
var x = 2;
console.log(x);
}
console.log(x);
}
2, undefined
2, 1
2, 2
SyntaxError
2, 2
2
Всплытие
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат фызова функции?
function letTest() {
let x = 1;
if (true) {
let x = 2;
console.log(x);
}
console.log(x);
}
2, undefined
2, 1
2, 2
SyntaxError
2, 1
2
Всплытие
questionTitle questionDescription answers correctAnswer explanation complexity theme
Какой будет результат фызова функции?
function test() {
let x = 1;
if (true) {
var x = 2;
console.log(x);
}
console.log(x);
}
2, undefined
2, 1
2, 2
SyntaxError
SyntaxError
2
Всплытие