JavaScript exercises for week 2
- Create an array and add three numbers to it.
- Use your array to return the second number.
- What data type is 123/12? "Things in quotes!"? undefined?
- Write an if statement that returns true.
- Consider these two arrays: myArray = ['Thomas', 'Amber', 'Raoul'] and emptyArray = []. Use a for loop to add our names to emptyArray. (Hint: n needs to be the length of the array. Google a helper method for finding the length of an array in Javascript. Is it the same as Ruby?)
- Write a function that returns your first name. Call it.
- Write a new function that takes your name as an input. The function should return your first name, plus your last name, as one string. (Hint: strings can be combined with a +)
- What is this? Does it have an equivalent in Ruby?
- Convert the above Person class to an ES2015 version using the new class syntax