-
Create an array containing the following strings:
"zebra", "giraffe", "elephant"
.- ["Zebra", "Giraffe", "Elephant"];
-
Save the array you created above to a variable
animals
.var animals = ["Zebra", "Giraffe", "Elephant"];
-
using the array
animals
, how would you access"giraffe"
?console.log(animals[1]);
-
How would you add
"lion"
to theanimals
array?animals.push("Lion");
-
Name and describe two additional array methods.
-
pop will remove an item from an array variable.
- To remove "elephant":
animals.pop();
-
unshift will add items to the front of the array variable.
- To add "gorilla" and "crocodile":
console.log(animals.unshift("gorilla", "crocodile"));
-
-
What are the boolean values in JavaScript?
- booleans are true/false. They are helpful when code can take more than one path (I don't fully understand this yet, but I think I am grasping the general idea of it.)
-
In JavaScript, how would you evaluate if
2
is equal to25
? What is the result of this evaluation?console.log(2 == 25);
false
-
In JavaScript, how would you evaluate if
25
is greater than2
? What is the result of this evaluation?
Last active
June 1, 2020 00:00
-
-
Save saraho1123/255dd980692af9d0c791bea18a8fb5d1 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment