You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create an array and access array elements using JS.
CFU
Create an array literal that stores your three favorite cities as literal strings.
Print out each element individually.
Stretch:
Use a for loop to print out all the items in turn.
Add, modify, and remove elements in an array.
CFU
Given the following array
var cities = ['Boulder', 'Lincoln', Chicago']
- Add a city to the end of the array
- Change 'Boulder' to 'Denver'
- Remove 'Lincoln'
Name and describe the 4 methods used to add and remove elements from the front and back of an array.
CFU
What are the 4 methods used to add and remove elements from the front and the back of an array?
Use the concat method to join 2 or more arrays.
CFU
Given the following arrays:
var east = ['Boston', 'New York', 'Philadelphia']
var west = ['San Diego', 'Portland', 'San Fransisco']
Use concat to join both arrays and store the result in a new variable.
Join arrays into strings and split strings into arrays.
CFU
Given the following string:
var myFavoriteIceCreamFlavor = 'Chocolate Chip'
Split the string and store the resulting array in a new variable.
and, given the following array:
var songTitle = [1,2,3,4,5,6]
Join the array into a string with each array element being separated by a dash.
Use Math.floor() and Math.random() to generate random integers.
CFU
Generate a random number between 1 and 100, store the number into a new variable