Without running the following code, try to determine:
let a = 1;
let b = 'bongos';
let c = true;
a = b;
b = c;
c = a;
- What is
a
?
a is ...
``` b
2. What is `b`?
b is ...
3. What is `c`?
``` true
c is ...
``` bongos
## Concatenation
Use the `+` operator to concatenate these strings together within a `console.log()`: "Red", "Hot", "Chilli", "Peppers". Make sure there are spaces in-between each word.
```js
const firstWord = "Red";
const secondWord = "Hot";
const thirdWord = "Chilli";
const fourthWord = "Peppers";
Result should be:
"Red Hot Chilli Peppers"
- Fill in the
console.log()
?
console.log(firstWord + ' ' + secondWord + ' ' + thirdWord + ' ' + fourthWord)
Output a console log The sum of 5 and 10 is 15
where the values for 5 and 10 are saved to variables, and where 15 comes from those variables being summed.
const num1 = 5;
const num2 = 10;
- How can we make
num3
equal to the sum ofnum1
andnum2
?
console.log (num1 + num2)
- Use variables
num1
,num2
andnum3
to fill in theconsole.log()
to complete the sentence:
The sum of 5 and 10 is 15
console.log( 'the sum of ' + num1 + ' and ' + num2 + ' is ' + num3)
By just looking at the following expressions, determine in your mind whether or not each will evaluate to true or false
a) 999 > 999
b) 999 === 999
c) 999 !== 999
d) -5 >= -4
e) 100 <= -100
f) 20 + 5 < 5
g) 81 / 9 === 9
h) 9 !== 8 + 1
- Write
true
orfalse
based on the list above
a) false
b) true
c)false
d) false
e) false
f) false
g) true
h) false
Declare a variable equal to a number 0 to 100
Write a conditional statement that...
- If it is a multiple of 3, print “Fizz” instead of the number.
- If it is a multiple of 5, print “Buzz” instead of the number.
- If it is a multiple of both 3 and 5, print “FizzBuzz” instead of the number.
- Otherwise, print the number
- Write your javascript solution below
// let i = ''
let numbers = Array(101).fill().map(function(v, i) { return i ; })
if (i%15 ===0){
console.log ('FizzBuzz')
}
else if (i%3 === 0) {
console.log("Fizz")
}
else if (i%5 === 0) {
console.log ('Buzz')
}
else {
console.log(i)
}
https://github.com/SEI2-jeddah/General/tree/master/homework_submission
-
Variables
- https://www.youtube.com/watch?v=cXUWYZXru6o (7 min video)
- https://www.codeanalogies.com/jsconstruction/ (interactive game)
-
Conditions
For more practice read about...