NEW
Font size
WorksheetsJavascript Lesson 11 + 12
Total questions: 20
Worksheet time: 7mins
Trong javascript, object nào đại diện cho trang web
document
window
location
browser
Phương thức nào để tìm element theo id
getElementById()
getElementsById
getElementId
getId
Nếu dùng code này thì sẽ lấy ra cái gì?
document.querySelectororAll('.box');
Lấy element cho class box đầu tiên
Lấy element có id là box
Lấy tất cả element có class là .box
getElementByClassName
Phương thức nào để thêm một element con
appendChild()
replaceChild()
addChild()
createChild()
Muốn thêm một function khi một event xảy ra thì dùng phương thức nào?
addEventListener
createEvent
addFunction
addEvent
Phương thức nào tìm kiếm element theo class
getElementsByTagName
getElementsByClassName
getElementsByClass
getElementByClassName
Cái nào dưới đây là web storage?
localStorage
serverStorage
webStorage
dataStorage
Muốn lưu dữ liệu thì sử dụng localStorage như thế nào?
localStorage.setItem('abc')
localStorage.setItem('name', 'abc')
setLocal('name', 'abc')
local.setItem('name')
Muốn di chuyển sang trang khác thì dùng phương thức nào
window.location.href
window.assign()
location.href
window.link
Phương thức nào để thực thi code lặp lại nhiều lần
interval
setInterval
setTimeout
setTime
Arrow function khai bao như thế nào?
const fName = () => {}
function fName() {}
const fName = function() {}
const fName => () = {}
Đoạn code sau hiển thị ra cái gì
const name = "MindX";
const str = ` hello, ${name}!
Welcome.`;
hello, MindX!
Welcome.
hello, MindX!Welcome.
hello, MindX!,Welcome.
Báo lỗi
Muốn sử dụng module trong javascript thì file js cần có thuộc tính gì?
type="javascript"
type="defer"
type="module"
type="importer"
Một module có thể có mấy giá trị mặc định khi export
1
2
10
bao nhiêu cũng đc
Spread và Rest dùng dấu gì để sử dụng?
( )
. . .
[ ]
{ }
Cho đoạn code sau:
const arr = [4, 5, 6];
const arr2 = [1, 2, 3];
let arrT = [...arr2, ...arr];
let [x, y] = [arrT[2], arrT[4]];
console.log(x, y);
6, 2
3, 5
2, 4
5, 1
Muốn import các giá trị không phải mặc định của module thì dùng dấu gì?
{ }
[ ]
không cần
" "
Hàm map dùng để làm gì?
Có thể thay đổi phần tử
Lọc các phần tử
Xử lí logic để tạo 1 giá trị nào đó
Hàm filter lọc phần tử thì cần phải trả về giá trị nào trong function?
true / false
0 / 1
chuỗi
phần tử đang duyệt
Cho đoạn code sau:
const arr = [1, 2, 3, 4];
const func = (x, y, ...rest) => x + y
console.log(func(...arr));
->> Kết quả in ra là:
3
7
10
5
