150+ Questions to Practice JavaScript's Foundational Concepts
Tags: javascript, frontend, webdev, programming
Published: 2023-06-24 12:10:46

JavaScript is one of the most used programming languages over the world. It has topped countless of charts and many developer surveys, time and again.

What I really like about JavaScript is that it's extremely easy to learn. Getting started is so simple that I can't even stress on it more.

You don't need to install interpreters/compilers or worry about any IDEs.

And once you start learning it, you don't even have to worry about strict typing, following any boilerplates (as in Java), or getting yourself through monotonous build/compile stages.

Really all that is needed is a browser and a simple text editor, although no one would use generic editors, like Notepad, these days, given that we have awesome editors, delivering an IDE-like experience, such as [Visual Studio Code](https://code.visualstudio.com/).

Anyways, coming back to the topic, given that JavaScript is so famous, it's no surprise that more and more people are learning it, or wanting to learn it.

In this regard, it's really fruitful to have a large bunch of questions to answer, related to JavaScript, in order to make sure that we know the concepts really well, once we've learnt them. 

Now a while ago, I released a new feature on [CodeGuage](https://www.codeguage.com/) called **Questions** (_pretty simple name, isn't it?_). As the name suggests, it is meant to provide a bunch of questions related to a given [course on CodeGuage](https://www.codeguage.com/courses/).

Learners can quickly go through the questions in order to ensure that they are well-versed in the underlying topic.

For JavaScript, I currently have a collection of over **150 questions** (156, to be precise) focusing on the [Foundation unit of the JavaScript course](https://www.codeguage.com/courses/js/introduction) at CodeGuage.

(_The end goal is to exceed the limit of 1000 questions on JavaScript, Python, and PHP, and make the 'Questions' feature on CodeGuage one of its kind._)

In this article, I aim to lay out all of the questions that I currently have on CodeGuage for JavaScript so that they can possibly reach a wider audience and then those interested can get to check out the answers of the questions back on CodeGuage.

I hope there is something new in these questions for everyone to learn. 🙂

Let's begin.

-----

> All the answers can be found at **[JavaScript Foundation Questions - CodeGuage](https://www.codeguage.com/questions/js/foundation)**.

-----

## The questions

All of the questions are grouped according to the chapter that they apply to. If you go through the chapter, you'll have answers to all of the questions.

### [Introduction](https://www.codeguage.com/courses/js/introduction)
1. **Who created JavaScript?**
2. **In which year was JavaScript first released?**
3. **What means when we say that JavaScript is a scripting language?**
4. **What means when we say that JavaScript is a high-level language?**
5. **What is meant by an implementation of JavaScript?**
6. **Name one implementation of JavaScript.**
7. **What programming paradigms does JavaScript support?**
8. **Where do we write JavaScript code so that it could be run in the browser?**
9. **What is an external JavaScript file?**
10. **How is a JavaScript file linked to in a webpage?**
11. **List 3 benefits of using an external JavaScript file for a webpage.**

### [Console](https://www.codeguage.com/courses/js/console)
12. **What is the console?**
13. **What is meant when we say that the console is a REPL environment for executing JavaScript?**
14. **The sole function of the console is to execute JavaScript. True or false? If false, then what else can it do?**
15. **How to log anything to the console?**

### [Basics](https://www.codeguage.com/courses/js/basics)
16. **What are integers?**
17. **What are floats?**
18. **JavaScript has separate types for integers and floats. True or false? If false, then give the correct explanation.**
19. **Name any five basic arithmetic operators that JavaScript provides along with their symbols.**
20. **What is meant when we say that the multiplication operator has a higher precedence than the addition operator in JavaScript?**
21. **How can we enforce a particular operation to happen before the other?**
22. **What is a string?**
23. **Give the three ways to denote a string in JavaScript.**
24. **What's the difference between single-quoted and double-quoted strings in JavaScript?**
25. **Can a single- or double-quoted string in JavaScript span multiple lines in source code?**
26. **What is an escape sequence?**
27. **List any three escape sequences.**
28. **How to denote new lines in single-quoted or double-quoted strings?**
29. **What is string concatenation?**
30. **Which symbol is used to perform string concatenation in JavaScript?**
31. **What is a variable?**
32. **How to create a variable in JavaScript?**
33. **Define the term 'keyword' in JavaScript. Give an example of a keyword.**
34. **What is variable declaration?**
35. **What is variable initialization?**
36. **What is variable assignment?**
37. **How is variable initialization different from variable assignment?**
38. **In JavaScript, a variable can hold values of any arbitary type. True or false? If false, then give the correct explanation.**
39. **Name the three different kinds of dialog boxes that could be shown using JavaScript.**
40. **Give the corresponding functions that can be used to show these dialogs.**
41. **What kind of values does `confirm()` return?**
42. **What does the second argument to `prompt()` do?**
43. **`prompt()` always returns a string, even if the Cancel button is clicked. True or false? If false, then give the correct explanation.**
44. **How to convert a string to a number?**

### [Variables](https://www.codeguage.com/courses/js/variables)
45. **What are the different variations of declaring variables using `var`?**
46. **Name three rules of naming variables in JavaScript.**
47. **Which casing convention is commonly used to name things in JavaScript?**
48. **How to check whether a given variable exists?**
49. **What is variable hoisting?**
50. **What is the `let` keyword?**
51. **Give two differences between `let` and `var`.**
52. **What is meant by the temporal dead zone of a variable creating using `let`?**

### [Constants](https://www.codeguage.com/courses/js/constants)
53. **What are constants in programming?**
54. **How to define a constant in JavaScript?**
55. **A constant can be defined without an initializer. True or false? If false, then give the correct description.**
56. **What is screaming snake casing and why is it commonly used to name constants in programming?**
57. **What are the rules for naming constants in JavaScript?**

### [Comments](https://www.codeguage.com/courses/js/comments)
58. **What are comments in programming?**
59. **Give two uses of comments in programming.**
60. **Name the two kinds of comments in JavaScript.**
61. **How to write a comment of each kind?**
62. **Give two tips for writing good comments.**

### [Data types](https://www.codeguage.com/courses/js/data-types)
63. **What is a data type?**
64. **What are primitives and objects in JavaScript?**
65. **Give one difference between primitives and objects?**
66. **Name the seven primitive types of JavaScript.**
67. **Take the numbers `10` and `10.5`. JavaScript considers these numbers to be of distinct types. True or false? If false, then give the correct explanation.**
68. **What is a number literal?**
69. **What is meant by the index of a character of a string?**
70. **What is the total number of characters in a string called?**
71. **How to retrieve the total number of characters of a string in JavaScript?**
72. **How can a primitive in JavaScript have a property available on it? Explain the phenomenon that enables this?**
73. **What is a Boolean?**
74. **Give the two Boolean values of JavaScript.**
75. **What is the purpose of the special value `undefined` in JavaScript?**
76. **What is the purpose of the special value null in JavaScript?**
77. **What is an array?**
78. **What is meant by an 'element' of an array?**
79. **What is meant by the index of an element of an array?**
80. **How to access the fifth element of an array stored in the variable `arr`?**
81. **What is the total number of items in an array called?**
82. **How to retrieve the total number of items of an array?**
83. **In JavaScript, the items of an array all have to be of the same type. True or false? If false, then give the correct explanation.**
84. **What is an array literal?**
85. **What happens when we access an out-of-range index of an array in JavaScript? Do we get an error?**
86. **Which method can be used to sort an array?**
87. **What means when we say that a method modifies an array in-place?**
88. **What is a function?**
89. **Functions in JavaScript can be named or anonymous. True or false? If false, then give the correct description.**
90. **Which keyword is used to define functions in JavaScript?**
91. **What is the difference between function parameters and arguments?**
92. **What is meant by the body of a function?**
93. **What is meant by the definition of a function?**
94. **What is meant by invoking a function?**
95. **How to invoke a function stored in a variable `func` in JavaScript?**
96. **How to return a given value from a function?**
97. **What is an object?**
98. **What is an object literal?**
99. **What is meant by the property of an object?**
100. **How to access the property named `bar` of an object stored in the variable `foo`?**
101. **What is the purpose of the `typeof` keyword in JavaScript?**
102. **The `typeof` keyword represents an expression. True or false? If false, then give the correct description.**
103. **What does `typeof null` return?**
104. **What does `typeof` return when used to inspect a function?**
105. **JavaScript is a dynamically-typed language. What does this mean?**
106. **Give an example of a statically-typed language.**

### [Control Flow](https://www.codeguage.com/courses/js/control-flow)
107. **What is meant by control flow?**
108. **What are conditional statements?**
109. **What are iteration statements?**
110. **What does the `if` statement do?**
111. **The body of an `if` statement can be a block statement. True or false? If false, then give the correct description.**
112. **What is a relational operation?**
113. **What does the `else` statement do?**
114. **Name any five relational operators in JavaScript along with their symbols.**
115. **What does the `switch` statement do?**
116. **What does the `case` keyword do?**
117. **What does the `default` keyword do?**
118. **The `default` keyword can be used outside `switch`. True or false?**
119. **What is the `for` statement used for?**
120. **Describe the typical syntax of a `for` statement.**
121. **What is meant by a counter variable?**
122. **What is the postfix increment operator?**
123. **Why is the counter variable of a `for` loop typically initialized to `0`?**
124. **What is the `while` statement used for?**
125. **What's the difference between `for` and `while`?**

### [Functions](https://www.codeguage.com/courses/js/functions)
126. **What is a function?**
127. **How to create a function in JavaScript using the `function` keyword?**
128. **What is a function's definition?**
129. **What is a function's body?**
130. **What does it mean to invoke a function?**
131. **How to invoke a function?**
132. **What is a function parameter?**
133. **What is a function argument?**
134. **In JavaScript, providing more arguments than a function is meant to entertain results in an error. True or false?**
135. **In JavaScript, providing less arguments than a function is meant to entertain results in an error. True or false? If false, then what happens with the parameters that aren't provided arguments?**
136. **What does the `return` keyword do?**
137. **The `return` keyword can be used outside functions as well. True or false?**
138. **The `return` keyword is followed by a statement. True or false? If false, then give the correct description.**
139. **What happens to the code written after a `return` statement?**

### [Operators](https://www.codeguage.com/courses/js/operators)
140. **What is meant by an operator?**
141. **What is meant by an operation?**
142. **What is meant by an operand?**
143. **What is meant by a unary, a binary, and a ternary operator?**
144. **List all the arithmetic operators in JavaScript.**
145. **There is only one string operator in JavaScript. True or false? If true, then which operator is it?**
146. **How does JavaScript distinguish between string concatenation and arithmetic addition, given that it's denoted via the same `+` symbol?**
147. **Name the operator used in the following expression: `i++`.**
148. **Name the operator used in the following expression: `++i`.**
149. **How does the expression `i++` differ from the expression `++i`?**
150. **What is meant by a relational operator?**
151. **What type of a value does a relational operator return?**
152. **List any three relational operators in JavaScript.**
153. **What is meant by a logical operator?**
154. **List the three logical operators in JavaScript.**
155. **What does it mean when we say that `||` and `&&` are both short-circuit operators in JavaScript?**
156. **What is the `??` operator called and what is its purpose?**

-----

## What now?

If you enjoyed going through this list of questions, and felt like you learnt something new, don't forget to ❤ the article, and give me your invaluable feedback 🙂.

And also make sure to checkout [CodeGuage.com](https://www.codeguage.com/) for more amazing courses on programming, all for free.