NEW
Font size
WorksheetsJavaScript
Total questions: 15
Worksheet time: 8mins
Perintah di javascript yang berfungsi untuk memberikan suatu informasi ke pengguna melalui jendela dialog dengan tombol Ok dan cancel adalah
prompt
confirm
dialog
write
Berikut adalah cara pembuatan array yang benar di javascript
mahasiswa = [‘Rini’,’Aldi’,’Acep’,’Putra’]
mahasiswa = {‘Rini’,’Aldi’,’Acep’,’Putra’}
mahasiswa = (‘Rini’,’Aldi’,’Acep’,’Putra’)
mahasiswa = ‘Rini’,’Aldi’,’Acep’,’Putra’
Berikut adalah jenis-jenis array di javascript, kecuali
Array Numerik
Array Assosiatif
Array Boolean
Array Campuran
Berikut ini dalah contoh event yang sering digunakan, kecuali
Onload
Onclick
Onchange
Ontime
Javascript memiliki beberapa tipe data seperti berikut, kecuali
List
Numerik
String
Boolean
Perintah di javascript yang berfungsi untuk menampilkan data/informasi dalam bentuk POP UP adalalah
Alert()
Show()
Write()
Pop_up()
Perl adalah singkatan dari
Practical Extraction and Reporting Language
Practical Emulation and Reporting Language
Principal Extraction and Reporting Language
Principal Emulation and Reporting Language
Which of the following keywords is used to define a variable in Javascript?
Var
Let
Both A and B
None of the above
Which of the following methods is used to access HTML elements using Javascript?getElementbyId()
getElementbyId()
ElementsByClassName()
Both A and B
None of the above
Which of the following methods can be used to display data in some form using Javascript?
document. write()
console.log()
window.alert()
All of the above
What will be the output of the following code snippet?
<script type="text/javascript">
a = 5 + "9";
document.write(a);
</script>
Compilation Error
14
Runtime Error
59
What will be the output of the following code snippet?
<script type="text/javascript" language="javascript">
var a = "Scaler";
var result = a.substring(2, 4);
document.write(result);
</script>
Al
Ale
Cal
Caler
When the switch statement matches the expression with the given labels, how is the comparison done?
Both the datatype and the result of the expression are compared
Only the datatype of the expression is compared
Only the value of the expression is compared
None of the above
What will be the output of the following code snippet?
(function(){
setTimeout(()=> console.log(1),2000);
console.log(2);
setTimeout(()=> console.log(3),0);
console.log(4);
}) ();
1 2 3 4
2 3 4 1
2 4 3 1
4 3 2 1
What will be the output of the following code snippet?
function solve(arr, rotations){
if(rotations == 0) return arr;
for(let i = 0; i < rotations; i++){
let element = arr.pop();
arr.unshift(element);
}
return arr;
}
// solve([44, 1, 22, 111], 5);
[111, 44, 1, 22]
[44, 1, 22, 111]
[111, 44, 1, 22]
[1, 22, 111, 44]
