DevAcademy

JavaScript Beginner Practice

82 questions covering 22 JavaScript topics.

Quick Quiz

1. Who created JavaScript?

2. JavaScript is standardized as?

3. Which engine is used in Google Chrome?

4. Which HTML tag is used to include JavaScript?

5. Which shortcut opens Developer Tools in Chrome (Windows)?

6. Which method is recommended for real-world projects?

7. Which keyword should be preferred by default?

8. Which keyword is block scoped?

9. Which symbol is used for a single-line comment?

10. Which syntax is used for multi-line comments?

11. Comments are...

12. Which of the following is NOT a primitive data type?

13. What is the output of typeof null?

14. Which data type is used to store very large integers?

15. Which function converts a value to a number?

16. What is the output of Boolean("")?

17. Which operator checks both value and data type?

18. What does this code log?

console.log([] + []);
console.log([] + {});
console.log(1 + "1");

19. Which operator compares both value and type?

20. What is the output of 10 % 3?

21. What is the output of "5" + 2?

22. Which statement executes code when a condition is true?

23. Which keyword is used to check multiple conditions?

24. Which statement is best for comparing one variable against multiple fixed values?

25. Which loop is commonly used when the number of iterations is known?

26. Which loop is best for iterating over arrays?

27. Which statement skips the current iteration?

28. Which index represents the first element of an array?

29. Which method adds an element to the end of an array?

30. Which property returns the total number of elements?

31. Which keyword is used to declare a function?

32. Which statement sends a value back from a function?

33. Which syntax represents an arrow function?

34. How are object properties stored?

35. Which notation is useful for dynamic property names?

36. Which method returns all property names?

37. Which keyword creates a block-scoped variable?

38. Which keyword is NOT block scoped?

39. Which scope allows inner functions to access parent variables?

40. Which keyword is initialized as undefined during hoisting?

41. Which variables remain in the Temporal Dead Zone?

42. Which function type can be called before its declaration?

43. What does this code log?

console.log(a);
var a = 5;

44. What does this code log?

console.log(b);
let b = 10;

45. Which property returns the number of characters in a string?

46. Which method converts a string to uppercase?

47. Which method converts a string into an array?

48. What does const [a, b] = [1, 2, 3] result in?

49. How do you skip the first element when destructuring an array?

50. What is the result of let [x, y] = [1, 2]; [x, y] = [y, x];?

51. When does a default value in const [a = 5] = [undefined] get used?

52. What does const [[a, b]] = [[1, 2]] destructure a and b to?

53. What determines which value a variable receives during object destructuring?

54. How do you rename "name" to "userName" while destructuring?

55. Given const { retries = 5 } = { retries: 0 }, what is the value of retries?

56. What does const { a, ...rest } = { a: 1, b: 2, c: 3 } assign to rest?

57. What happens when you run const { name } = undefined;?

58. What does [...[1, 2], ...[3, 4]] evaluate to?

59. In { ...defaults, ...overrides }, which object's value wins for a shared key?

60. What does [..."hi"] evaluate to?

61. Given const b = { ...a }; b.nested.value = 99;, what happens to a.nested.value if "nested" is an object?

62. What is the old, pre-spread way to call Math.max() with an array of numbers?

63. What does function f(...args) { return args; } return when called as f(1, 2, 3)?

64. Which of these is a valid rest parameter declaration?

65. What is a key limitation of the old arguments object compared to rest parameters?

66. In const [a, ...rest] = [1, 2, 3], what role does ...rest play?

67. How can you distinguish rest from spread when you see ... in code?

68. Which character is used to delimit a template literal?

69. What does `Total: ${2 + 3}` evaluate to?

70. How do you create a multi-line string with a template literal?

71. In a tagged template like tag`Hi ${name}`, what is the first argument the tag function receives?

72. What must you do to include a literal backtick character inside a template literal?

73. Which of the following is valid JSON?

74. What does JSON.stringify({ a: undefined, b: 1 }) return?

75. What is the purpose of the third argument to JSON.stringify()?

76. What does the reviver function passed to JSON.parse() do?

77. What happens when JSON.stringify() encounters a circular reference?

78. What does user?.address?.zip evaluate to if user.address is undefined?

79. What does 0 || 50 evaluate to?

80. What does 0 ?? 50 evaluate to?

81. Which syntax safely calls a function only if it exists?

82. What is required to combine ?? with || in the same expression?