First and foremost, understand the material we covered and get comfortable with it. Like I said in class, this will be hard, it will be confusing and frustrating. It's okay.
Just hang in there and ask questions! I'm available on Slack and in person for questions.
Create a function that takes a name, gender, and age as arguments and return an object with those properties.
createPerson('Sarah', 'F', 23)
returns{name:'Sarah', gender:'F', age:23}
- Don't forget to
return
at the end! console.log()
is a great way to test your function
Create a function that only returns true
if the passed username and password match 'user'
and 'pass123'
.
checkCredentials('user','opensesame')
returnsfalse
checkCredentials('me','opennow')
returnsfalse
checkCredentials('user','pass123')
returnstrue
- Don't forget about your logical operators!
Create a function called sumArray
that takes an array as an argument and returns the sum of it's elements.
sumArray([1,2,3])
returns6
sumArray([])
returns0
- This only needs to work for numbers
- You will need a variable to store the total, I suggest calling it
total
- You will need to loop through the array and update the total