1. What command is used for showing all files and directories including hidden files from the current working directory?
ls -a
2. Given the above file structure how can I move styles.css into the directory of styles from ~/Desktop/care/terminal-commands
mv html-css/styles.css html-css/styles/
3. Given the above file structure how can I copy script.js into the directory of html-css/js from ~/Desktop/care/terminal-commands
cp script.js html-css/js
1. Name as many primative JS data types as you can remember. There are 7
string, number, boolean, undefined, null, bigInt, symbol
2. Name two data structures in JS that you have learned about
array and object
3. Describe control flow and name a few ways to code control flow. Name three types
The ordering of when code is executed.
- sequential flow (top to bottom)
- conditional flow (if, else if, else)
- repetitive flow (looping)
- Make a temp variable.
- Write a chaining conditional statement that
- checks if the temp is > 90 and logs 'it is hot'
- checks if temp is > 70 and logs 'it is pretty nice'
- finally a catch all (else) with a log of 'nothing above is truthy'
const foods = ['pizza', 'ice cream', 'salad']
- Write a loop of your choice that loops through the above array and logs each element with a string added, 'is sooo good!'
const movies = ['Pan\'s Labyrinth', 'Crimson Peak', 'Hellboy']
- Access the last element in the above array.
- Change Crimson Peak to your favorite movie.
- Add the string of 'Ghost' to the front of the array with an array method.
- Loop through the array with the forEach() array method.
const myDog = {
name: 'Klondike',
breed: 'Goldent Retriever',
activies: ['fetching the ball', 'hiking'],
age: 6
}
- Access the string of hiking in the myDog object.
- Update the age key of myDog to 7.
- Loop through myDog and log the values of each key.
function calculate(num1, num2, operator){
let result
}
console.log(calculate(2, 4, 'add'))
- What are the parameters of this function?
- What are the arguments in the example above?
- What is the purpose of
return
- Complete this function so that when the function runs it returns a result of 8.
- If I console.log(result) outside of the function, what would you expect and why?