Professional Documents
Culture Documents
CSLT Trac Nghiemcode
CSLT Trac Nghiemcode
}
foo();
A. second first 1 3 B. first second 3 2
C. second first 3 3 D. first second 3 3
Câu 20:Cho đoạn code sau, kết quả là:
function sayHi() { return (() => 0)();}
console.log(typeof sayHi());
A. object B. number C. function D.Undefined
Câu 21:Đoạn code sau sẽ có kết quả:
const a = {
stringField: 'Joe',
numberField: 123, dateField: new Date('1995-12-17T03:24:00'), nestedField: { field:
'Nested'}
};
const b = JSON.parse(JSON.stringify(a));
console.log(a.stringField === b.string Field, a.numberField === b.numberField,
a.dateField === b.dateField, a.nested Field.field: = b.nestedField.field ===);
A. true true true true
B. true true true false
C. true true false true
D. false false false false
Câu 22:Đoạn code trên sẽ có kết quả là:
const notifications = 1;
console.log(`You have ${notifications} notification${notifications != 1 && 's'});
A. You have 1 notification
B. You have 1 notifications
C. You have 1 notificationfalse
Câu 23Cho đoạn code sau, kết quả sẽ là:
const compare = a => a === a;console.log(compare(null)); console.log(compare
(undefined));
console.log(compare(NaN)); console.log(compare([NaN]));
Atrue true true true
B. true false true true
C. true true false true
D. true true false false
Câu 24Cho đoạn code sau, kết quả là:
const n = 5;
console.log(1..n); //?
A. [1, 2, 3, 4, 5]
B. undefined
C. Syntax error
Câu 25:Cho đoạn code sau, kết quả là:
const a = {
stringField: 'Joe', nestedField: { field: 'Nested' }, functionField: () => 'aReturn'};
const b = Object.assign({}, a);
b.stringField 'Bob'; b.nestedField.field= 'Changed';
b.functionField = () => 'bReturn';
console.log(a.string Field, a.nestedField.field, a.functionField());
A. Joe Nested a Return
B. Bob Changed bReturn
C. Joe Changed aReturn
D. Bob Nested bReturn
Câu 26:Cho đoạn code sau, kết quả là:
const url = 'quiz.duthaho.com';.split('.') .filter(Boolean);
const { length: In, [In - 1]: domain = 'quiz' } = url console.log(domain);
A. "quiz"
B. "duthaho" C. "com" D. undefined
Câu 27:Cho đoạn code, kết quả là
const obj = {a: 'one', b: 'two', a: 'three' }; console.log(obj);
A. {a: "one", b: "two"} B. {b: "two", a: "three"}
C. {a: "three", b: "two"} D. SyntaxError
Câu 28:Kết quả của đoạn code là:
const user = {name: 'lao Hac',age: 69,
pet: {type: 'cho',name: 'vang'};
Object.freeze(user);
user.pet.name = 'shiba';
console.log(user.pet.name);
A. shiba B. vang C. An error is thrown
Câu 29:Đoạn code sau, kết quả sẽ là:
const obj = {1: 1,2:2, 3:3};
console.log(Object.keys(obj), Object.values(obj));
A. [1, 2, 3] ["1", "2", "3"]
B. ("1", "2", "3"] [1, 2, 3] C. ["1", "2", "3"] ["1", "2", "3"]
Câu 30:Cho đoạn code sau, kết quả sẽ là:
const obj = {1: 'a', 2: 'b', 3: 'c' };
const set = new Set([1, 2, 3, 4, 5]);
obj.hasOwnProperty('1'); obj.hasOwnProperty(1);
set.has('1'); set.has(1);
A. false true false true B. false true true true
C. true true false true D. true true true true
Câu 31:Đoạn code sẽ cho kết quả
const a = {};
const b = { key: 'b' }; const c = { key: 'c' };
a[b] = 123; a[c] = 456;
console.log(a[b]);
A. 123 B. 456 C. undefined D. ReferenceError
Câu 32Đoạn code sau sẽ cho kết quả là:
const scrambled = {2: 'e',
5: '0',1: 'h',4: '1', 3: 'I'};
const result = Object.values (scrambled).reduce( (agg, el) => agg + el,);
console.log(result);
A. hello B. eohl
C. Cả A, B đều đúng D. Cả A, B đều sai
Câu 33:Đoạn code sau sẽ cho kết quả:
let b = '4';
console.log(b+++ 3, b);
A. 44 4 B. 85 C. 75 D. 43 5
Câu 34:Đoạn code sau sẽ cho kết quả gì?
console.log(1 <2 <3); console.log(3 > 2 > 1);
A. true true
B. true false
C. false false
D. undefined undefined