تنويه هنا عند الإجابة على كل سؤال قم بنسخ الكود وقم بتجربة ما إذا كان صحيح والرجو الإجابة قبل التجربة كل ماترتفع في الأسئلة تزيد درجة الصعوبة المهم لا تفشل إذا لم تجب بالشكل الصحيح حاول قراءت الكود أكثر من مرة ومحاولة فهمه و وفقك الله.
console.log(x);
var x = 12;
- A)undefined
- B)12
- C)SyntaxError
- D)ReferenceError
console.log("2" + "2"- "2");
- A)20
- B)2
- C)SyntaxError
- D)0
console.log(x);
let x = 12;
- A)undefined
- B)12
- C)SyntaxError
- D)ReferenceError
const x = 12;
x = 100;
console.log(x);
- A)TypeError
- B)100
- C)12
- D)ReferenceError
console.log(12.toString());
- A)"12"
- B)12
- C)SyntaxError
- D)ReferenceError
console.log("0" === []);
- A)true
- B)false
- C)SyntaxError
- D)ReferenceError
console.log([] === []);
- A)true
- B)false
- C)SyntaxError
- D)ReferenceError
console.log("12" == 12);
- A)true
- B)false
- C)SyntaxError
- D)ReferenceError
console.log(String("12") === 12);
- A)true
- B)false
- C)SyntaxError
- D)ReferenceError
console.log(String("12") === String("12"));
- A)true
- B)false
- C)SyntaxError
- D)ReferenceError
console.log(+"12");
- A)12
- B)null
- C)SyntaxError
- D)"12"
console.log(3 < 2 < 1);
- A)false
- B)SyntaxError
- C)true
- D)ReferenceError
console.log(3 + 2 * 4);
- A)11
- B)SyntaxError
- C)20
- D)ReferenceError
function person() {
console.log(name);
console.log(age);
var name = "Ayoub";
let age = 17;
}
person();
- A)Ayoub & undefined
- B)Ayoub & ReferenceError
- C)ReferenceError & 17
- D)undefined & ReferenceError
let obj = {
name: "Ayoub",
info: fucntion () {
console.log(this.name);
}
}
obj.info()
- A)window
- B)SyntaxError
- C)Ayoub
- D)ReferenceError
let x = {name: "Ayoub"};
let y;
x = y;
x.name = "Ali";
console.log(y.name)
- A)Ali
- B)undefined
- C)Ayoub
- D)ReferenceError
let num = 0;
console.log(num++);
console.log(++num);
console.log(num);
- A)0 2 2
- B)1 2 2
- C)0 1 2
- D)1 1 2
for (var i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 1);
}
for (let i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 1);
}
- A)0 1 2 & 3 3 3
- B)0 1 2 & 0 1 2
- C)3 3 3 & 0 1 2
- D)ReferenceError
const name = "Ayoub";
age = 17;
console.log(delete name);
console.log(delete age);
- A)false & true
- B)Ayoub & 17
- C)undefined & undefined
- D)ture & true
const set = new Set([1, 1, 2, 3, 4]);
console.log(set);
- A){1, 1, 2, 3, 4}
- B)[1, 2, 3, 4]
- C){1, 2, 3, 4}
- D)[1, 1, 2, 3, 4]
(() => {
let x = (y = 10);
})();
console.log(typeof x);
console.log(typeof y);
- A)object & number
- B)number & number
- C)undefined & number
- D)number & undefined
[1, 2, 3].map(num => {
if (typeof num === "number") return;
return num * 2;
});
- A)[undefined, undefined, undefined]
- B)[null, null, null]
- C)[ 3 x empty ]
- D)[ ]
const x = parseInt("3*2", 10);
console.log(x);
- A)"6"
- B)6
- C)NAN
- D)3
let person = { name: "ayoub" };
const m = [person];
person = null;
console.log(members);
- A)[{ name: "ayoub" }]
- B)[null]
- C)[{ }]
- D)null
function* generator(i) {
yield i;
yield i * 2;
}
const g = generator(10);
console.log(g.next().value);
console.log(g.next().value);
- A)20, 20
- B)10, 20
- C)[0, 10], [10, 20]
- D)0, 10 & 10, 20
const firstPromise = new Promise((res, rej) => {
setTimeout(res, 500, "one");
});
const secondPromise = new Promise((res, rej) => {
setTimeout(res, 100, "two");
});
Promise.race([firstPromise, secondPromise]).then(res => console.log(res));
- A)"two" "one"
- B)"two"
- C)"one" "two"
- D)"one" "two"
console.log(typeof typeof 1);
- A)"string"
- B)number
- C)Array
- D)Object
console.log(+ "1" + + "1" + "1");
- A)"21"
- B)21
- C)3
- D)Error
const isTrue = true == [];
const isFalse = true == ![];
console.log(isTrue + isFalse)
- A)0
- B)"true"
- C)true
- D)1
const numbers = [33, 2, 8];
numbers.sort();
console.log(numbers[1])
- A)33
- B)2
- C)8
- D)6
function test(x = 3, y) {
return [x, y]
}
console.log(test(2))
- A)[2, 3]
- B)[3, 2]
- C)[2, undefined]
- D)[undefined, 3]
const str = "foo bar";
const p = [...str].map(e => {
e.toUpperCase();
}).join("_")
console.log(p);
- A)Foo_Bar
- B)undefined
- C)F_O_O_B_A_R
- D)F_O_O B_A_R