Worksheetsfundamental 2
Total questions: 51
Worksheet time: 13hrs 45mins
console.log(typeof null)
console.log(typeof 'false')
null & boolean
null & string
object & string
object & boolean
udin
error
undefined
name
let i = 10;
while(i > 9) {
console.log(i);
}
i++;
10
error
infinite loop
11
perbedaan var dengan let?
var dapat assign ulang let tidak dapat di assign ulang
var dan let sama sama dapat declare ulang dan assign ulang
var bisa declare dan assign ulang tetapi let hanya bisa assign ulang saja
var bisa declare dan assign ulang tetapi let hanya bisa declare ulang saja
const name = udin;
name = hello;
console.log(name);
udin
udin is not defined
hello
hello is not defined
const nilai = 100;
if(nilai > 100) console.log("how??")
else if(nilai < 100) console.log("gws")
else console.log("selamatt")
how
gws
selamat
selamatt
const false = "true"
console.log(false)
false
true
"true"
error
const penjumlahan = (a,b) => a*b
console.log(penjumlahan(10))
10
100
0
NaN
const array1 = [1, 2, 3, 4];
const array2 = [1, 2, 3, 4];
array1.concat(array2);
console.log(array1);
[1,2,3,4]
[1,2,3,4,[1,2,3,4]]
[1,2,3,4,1,2,3,4]
[[1,2,3,4],1,2,3,4]
const array1 = [1, 2, 3, 4];
array1.splice(3, 20, 6, 7);
console.log(array1);
[1,2,3,4]
[ 1, 2, 3, 6, 7 ]
[1,2,3,4,6,7]
[1,2,3]
const array1 = [1, 2, 3, 4];
array1.shift(20);
console.log(array1);
[ 2, 3, 4 ]
[20,1,2,3,4]
[1,2,3]
[1,2,3,4,20]
const array1 = [1, 2, 3, 4];
array1.unshift();
console.log(array1);
[undefined,1,2,3,4]
[1,2,3,4]
error
[2,3,4]
let i = 10;
console.log(i++)
console.log(++i)
console.log(i)
10
11
12
11
11
12
10
12
12
11
12
12
let bool = true;
bool += false;
console.log(bool)
true
false
truefalse
1
perbedaan foreach dengan filter yang paling tepat
foreach tidak memiliki return sedangkan filter memiliki return
foreach loop sebanyak length sedangkan filter hanya loop sesuai kondisi
foreach dan filter sama sama loop tetapi filter memiliki kondisi return
foreach dan filter return array, tetapi filter melakukan return sesuai kondisi
let angkaz = "20i";
angkaz = Number(angkaz);
console.log(typeof angkaz);
NaN
string
"20i"
number
FIFO atau First in First Out merupakan konsep yang digunakan pada salah satu jenis data structure. Data structure yang menggunakan FIFO adalah?
queue
stack
linked list
hash table
const data = [
{name: "udin"}, (something) => console.log(something) ]
tampilkan "udin" saja dalam data lewat console.log
data[1](data[0].name);
console.log(data.name)
console.log(data[1](data[0].name));
console.log("udin")
penjumlahan2(4);
function penjumlahan2(numb) {
console.log(numb * numb);
}
error
16
8
2
penjumlahan3(4);
const penjumlahan3 = (n) => {
console.log(n * n);
};
error
16
8
4
let n = "10";
n++;
n += 2;
n *= "5";
n += "12";
console.log(n);
1012512
6512
72
7212
const call = () => {
let name = "hey";
return name;
};
console.log(name);
error
"hey"
undefined
null
const numbers = [5, 4, 10, 2];
numbers.push(12);
numbers.sort();
console.log(numbers);
[ 10, 12, 2, 4, 5 ]
[2,4,5,10,12]
[5,4,10,2,12]
[12,2,10,4,5]
const numbers = ["alfred300", "a", "anjaz21", "udin10", "andrew"];
numbers.push(2);
numbers.push("1");
numbers.sort();
console.log(numbers);
[ '1', 2, 'a', 'alfred300', 'andrew', 'anjaz21', 'udin10' ]
[ 2, '1' , 'a', 'alfred300', 'andrew', 'anjaz21', 'udin10' ]
[ '1' , 'a', 'alfred300', 'andrew', 'anjaz21', 'udin10' ,2]
[ '1' , 'a', 2, 'alfred300', 'andrew', 'anjaz21', 'udin10' ]
let name = "naruto"
let counter = "0"
if(counter) name += " uzumaki"
console.log(name)
naruto
uzumaki
naruto uzumaki
udin
const { log } = console;
log("hey");
hey
error
null
undefined
const arrs = [1, 2, 3];
const { push } = arrs;
push(4);
console.log(arrs)
error
[1,2,3,4]
4
undefined
let caption = "hello bro semua";
console.log(caption.slice(0, 8));
hello bro
hello br
o semua
semua
mana yang falsy
true
"0"
"false"
0
let ang = 50;
let check = (100 > ang && 10) || ang;
console.log(!check);
10
100
50
false
let person = { name: "ujang" };
let newPerson = person;
newPerson.name = "andrew";
person.name = "hobbit";
delete person.name;
console.log(newPerson.name);
undefined
ujang
andrew
hobbit
const numbers2 = [1, 2, 3, -1, -2, 10, , 1.23, 12, 5];
numbers2.sort();
console.log(numbers2);
[ -1, -2, 1, 1.23, 10, 12, 2, 3, 5]
[ -1, -2, 1, 1.23, 10, 12, 2, 3, 5, <1 empty item> ]
[ -1 ,1, 1.23, 10, 12,-2, 2, 3, 5]
[ undefined, -1, -2, 1, 1.23, 10, 12, 2, 3, 5]
Tipe data apa yang kita gunakan untuk menyimpan angka desimal?
obj
string
float
int
string merupakan kumpulan dari
kata
huruf
karakter
angka
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
console.log("hello"); } }
time complexity diatas adalah?
O(N)
O(N^2)
O(N^3)
O(N^N)
const obj = {
name : "helo"
}
const newObj = obj;
newObj merupakan copyan dari obj dengan cara
deep copy
shallow copy
shallot copy
deep fake
if (Infinity > Number.MAX_VALUE) console.log("lebih besar");
console.log("hore");
lebih besar
hore
lebih besar
hore
semua jawaban salah
udin
error
undefined
null
Berikut ini yang merupakan metode pada array yang dapat diterapkan sebagai stack adalah?
push & pop
shift & unshift
join & concat
splice & concat
let i = 10;
do {
let i = 20;
console.log(i);
} while (i < 20);
error
infinite loop
loop 1x dan memunculkan 20
loop 1x dan memunculkan 10
let arr = [1, 2, 3, 4, 5];
arr.pop();
console.log(arr);
[1, 2, 3, 4]
[1, 2, 3, 4, 5]
[1, 2, 3]
[2, 3, 4, 5]
What is the result of 10 + '5'?
105
15
1050
Error
What is the output of console.log(typeof 10)
number
string
object
undefined
let x = 10;
let y = 20;
console.log(x + y);
30
10
20
error
const arr = [1, 2, 3, 4, 5];
console.log(arr.slice(2, 4));
[2, 3]
[3, 4]
[1, 2]
[4, 5]
let name = "John";
console.log(name.toUpperCase());
JOHN
John
john
ERROR
What will be the output of console.log(typeof NaN)
number
string
NaN
undefined
What is the result of console.log(10 + "20")
30
1020
error
undefined
What will be the output of console.log(0.1 + 0.2 === 0.3)
true
false
error
undefined
What will be the output of the following code?
let x = 10;
let y = 20;
console.log(x - y);
-10
10
30
error
What is the result of console.log(typeof 'hello' + 10)?
string10
number
string
error
