Beginner JavaScript Worksheet - Free Printable
Educational worksheet: Beginner JavaScript Worksheet. Download and print for classroom or home learning activities.
PNG
716×537
73.7 KB
Free · Personal Use
Quality Assured by Worksheets Library Team
Reviewed for educational accuracy and age-appropriateness
ID: #1346842
⭐
Show Answer Key & Explanations
Step-by-step solution for: Beginner JavaScript Worksheet
▼
Show Answer Key & Explanations
Step-by-step solution for: Beginner JavaScript Worksheet
Let's go through the Beginner JavaScript Review Worksheet step by step and solve each part.
---
1. JavaScript is a programming language
✔ True
*Explanation:* JavaScript is indeed a programming language. It's a high-level, interpreted language commonly used for web development.
2. JavaScript is not a scripting language
✘ False
*Explanation:* JavaScript is a scripting language. While it's also a full-fledged programming language, it's typically categorized as a scripting language because it's often used to add interactivity to web pages and runs in a browser environment.
3. If you want to output the word "Hello" to the console you can simply type "console.log('hello')"
✔ True
*Explanation:* Yes, `console.log('hello')` will output the string `"hello"` to the browser's console. Note: The case doesn't matter for the output (it prints lowercase), but the syntax is correct.
---
#### Question 1:
What will the following code output?
```javascript
var num1 = 7;
var num2 = 2;
console.log(num1 * num2 + num1);
```
Let’s evaluate:
- `num1 * num2` = 7 × 2 = 14
- Then add `num1`: 14 + 7 = 21
So the output is 21.
✔ Answer: C. 21
> ⚠️ Note: Multiplication (`*`) has higher precedence than addition (`+`), so it's evaluated first.
---
#### Question 2:
Will the following code output `true` or `false`?
```javascript
var testScore1 = 80;
var testScore2 = 90;
```
Wait — this code only declares variables and assigns values. There is no condition or comparison (like `testScore1 > testScore2` or anything similar) that would result in `true` or `false`.
👉 So, this code does not output anything at all — it just sets two variables.
But since the question asks whether it outputs `true` or `false`, and there's no `console.log()` or conditional statement, the answer should be:
✘ Neither true nor false — it outputs nothing.
However, if this is a typo and the intention was to compare them (e.g., `console.log(testScore1 > testScore2)`), then:
- 80 > 90 → `false`
But based on what's written, the code does not output anything, so technically, it does not output `true` or `false`.
But assuming the worksheet meant to ask about a comparison like:
```javascript
console.log(testScore1 > testScore2);
```
Then the answer would be: False
Since the problem says "will the following code output true or false?" and only shows variable declarations, we must assume either:
- The question is incomplete, or
- It's implied that we're evaluating `testScore1 > testScore2` (a common follow-up).
Given typical worksheet patterns, likely the intended question was:
> Will `testScore1 > testScore2` evaluate to true or false?
In that case:
- 80 > 90 → False
✔ Answer: False
---
#### Part 1:
1. True
2. False
3. True
#### Part 2:
1. C. 21
2. False *(assuming the intent was to compare test scores)*
---
Let me know if you'd like a version of this worksheet with answers filled in!
---
Part 1: True or False Questions
1. JavaScript is a programming language
✔ True
*Explanation:* JavaScript is indeed a programming language. It's a high-level, interpreted language commonly used for web development.
2. JavaScript is not a scripting language
✘ False
*Explanation:* JavaScript is a scripting language. While it's also a full-fledged programming language, it's typically categorized as a scripting language because it's often used to add interactivity to web pages and runs in a browser environment.
3. If you want to output the word "Hello" to the console you can simply type "console.log('hello')"
✔ True
*Explanation:* Yes, `console.log('hello')` will output the string `"hello"` to the browser's console. Note: The case doesn't matter for the output (it prints lowercase), but the syntax is correct.
---
Part 2: Multiple Choice
#### Question 1:
What will the following code output?
```javascript
var num1 = 7;
var num2 = 2;
console.log(num1 * num2 + num1);
```
Let’s evaluate:
- `num1 * num2` = 7 × 2 = 14
- Then add `num1`: 14 + 7 = 21
So the output is 21.
✔ Answer: C. 21
> ⚠️ Note: Multiplication (`*`) has higher precedence than addition (`+`), so it's evaluated first.
---
#### Question 2:
Will the following code output `true` or `false`?
```javascript
var testScore1 = 80;
var testScore2 = 90;
```
Wait — this code only declares variables and assigns values. There is no condition or comparison (like `testScore1 > testScore2` or anything similar) that would result in `true` or `false`.
👉 So, this code does not output anything at all — it just sets two variables.
But since the question asks whether it outputs `true` or `false`, and there's no `console.log()` or conditional statement, the answer should be:
✘ Neither true nor false — it outputs nothing.
However, if this is a typo and the intention was to compare them (e.g., `console.log(testScore1 > testScore2)`), then:
- 80 > 90 → `false`
But based on what's written, the code does not output anything, so technically, it does not output `true` or `false`.
But assuming the worksheet meant to ask about a comparison like:
```javascript
console.log(testScore1 > testScore2);
```
Then the answer would be: False
Since the problem says "will the following code output true or false?" and only shows variable declarations, we must assume either:
- The question is incomplete, or
- It's implied that we're evaluating `testScore1 > testScore2` (a common follow-up).
Given typical worksheet patterns, likely the intended question was:
> Will `testScore1 > testScore2` evaluate to true or false?
In that case:
- 80 > 90 → False
✔ Answer: False
---
✔ Final Answers:
#### Part 1:
1. True
2. False
3. True
#### Part 2:
1. C. 21
2. False *(assuming the intent was to compare test scores)*
---
Let me know if you'd like a version of this worksheet with answers filled in!
Parent Tip: Review the logic above to help your child master the concept of javascript worksheet.