JavaScript test
10.7K subscribers
3.03K photos
6 videos
4.09K links
Проверка своих знаний по языку JavaScript.

Ссылка: @Portal_v_IT

Сотрудничество: @oleginc, @tatiana_inc

Канал на бирже: telega.in/c/js_test

РКН: clck.ru/3KHeYk
Download Telegram
❗️Что будет на выходе:

const clothes = [ 'jacket', 't-shirt' ];
clothes.length = 0;
console.log(clothes[0]);

Ответ: undefined

JavaScript test | #JavaScript
Please open Telegram to view this post
VIEW IN TELEGRAM
❗️Что будет на выходе:

const weakMap = new WeakMap();
const obj1 = {};
const obj2 = { key: 'value' };

weakMap.set(obj1, obj2);

const result = weakMap.get(obj1).key.split('').reverse().join('');

console.log(result);

Ответ: "eulav"

JavaScript test | #JavaScript
Please open Telegram to view this post
VIEW IN TELEGRAM
❗️Что будет на выходе:

for (var i =0; i < 10; i++){
setTimeout(function (){
console.log(i);
}, 0);
}

Ответ: 10 10 10 10 10 10 10 10 10 10

JavaScript test | #JavaScript
Please open Telegram to view this post
VIEW IN TELEGRAM
❗️Что будет на выходе:

const x = 0.1 + 0.2;
const y = 0.3;

console.log(x === y);
console.log(x.toFixed(1) === y.toFixed(1));
console.log(+x.toFixed(1) === +y.toFixed(1));

const num = 42;
console.log(num.toString(2));
console.log(parseInt('101010', 2));

Ответ: false true true 101010 42

JavaScript test | #JavaScript
Please open Telegram to view this post
VIEW IN TELEGRAM
❗️Что будет на выходе:

const x = 5;
const y = 10;

const result = `${x + y}`;
const nested = `Value: ${`${x}` + `${y}`}`;
const expr = `${x}${y}`;

console.log(result);
console.log(nested);
console.log(expr);
console.log(typeof result);

Ответ: 15 Value: 510 510 string

JavaScript test | #JavaScript
Please open Telegram to view this post
VIEW IN TELEGRAM