-
Make two directories inside
~/buffy
:scoobies
andvamps
: -
Create files in
scoobies
namedbuffy.txt
andangel.txt
: -
Copy
angel.txt
into thevamps
directory: -
Delete the
vamps
directory and everything inside it:
-
Assign the string "Ahab" to a variable named
captain
: -
Using the
captain
variable instead of the text "Ahab", use string concatenation to form the string "Oh Ahab, my Ahab!", assigning it to a variable namedphrase
:
var souls = 3;
var lifeRafts = 2;
- Assuming the above variables, write an
if
statement that console.logs "SOS!" if there are moresouls
thanlifeRafts
(no need to write a function, just theif
statement please):
-
Create an array named
weekend
with just a string 'Saturday' in it: -
Add the string 'Sunday' to the end of the
weekend
array: -
Now add the string 'Friday' to the front of the
weekend
array: -
Using square bracket notation, access 'Saturday' in the
weekend
array and assign to a variable namedday
(Note: the array has three days in it as this point): -
Remove 'Friday' from the array:
-
Loop through the
weekend
array and for each element in it, print"Woohoo! It's finally <day name>"
-
Write an object literal named
brain
having a property with a key ofenergyLevel
and a numeric value of10
: -
Assign the value of the property
energyLevel
to a variable namedenergy
: -
Add a
dream
property to thebrain
object that holds the string 'electric sheep':
-
Write a function named
computeArea
that has two parameters,length
&width
, and returns the area of a rectangle (the product oflength
andwidth
): -
Invoke the
computeArea
function with3
and4
as arguments and save the returned result to a variable namedarea
: -
Write a function
findMax
that takes in 1 paramater, an array of numbers, and returns the highest number in that array.