// Data Structures - Arrays (1 pt) // var pantry = [ // ['nutella', 'honey'], // ['pasta', 'rice', ['flour', 'maple syrup']] // ] // write code to log maple syrup in the console using the the pantry...

1 answer below »

// Data Structures - Arrays (1 pt)


// var pantry = [


// ['nutella', 'honey'],


// ['pasta', 'rice', ['flour', 'maple syrup']]


// ]


// write code to log maple syrup in the console using the the pantry array above





// loops (5pt)


// using a while loop print the following in the console:


// 17


// 15


// 13


// 11


// 9


// 7


// 5


// 3


// 1



// loop through the days array using a while loop to print the following in the console


// var days = ['Thursday', 'Friday', 'Saturday', 'Sunday']


// 0 Thursday


// 1 Friday


// 2 Saturday


// 3 Sunday





// Objects & arrays (2pt)


// assume the following object:



// var brain = {


// energyLevel: 10,


// favMovies: ['Jaws', 'The Fellowship of the Ring', 'Howl\'s Moving Castle', 'Django Unchained', 'Cloud Atlas', 'The Usual Suspects', 'Toy Story', 'Conan the Barbarian', 'Titanic', 'Harry Potter', 'Fried Green Tomatoes', 'Volver', 'Oculus', 'Seven', 'Black Panther', 'Harry Potter', 'Imitation of Life', 'Snatch', 'Fast and Furious']


// }


// write code to console log the last movie using the brain object above (assume Jaws is the first movie)


// write code to change energyLevel to 99





// builtin functions (4pt)


// var favMovies = ['Jaws', 'The Fellowship of the Ring', 'Howl\'s Moving Castle', 'Django Unchained', 'Cloud Atlas', 'The Usual Suspects', 'Toy Story', 'Conan the Barbarian', 'Titanic', 'Harry Potter', 'Fried Green Tomatoes', 'Volver', 'Oculus', 'Seven', 'Black Panther', 'Harry Potter', 'Imitation of Life', 'Snatch', 'Fast and Furious'];


// write code to randomly select a movie from the favMovies array and store it in a variable


// write code to print the movie in uppercase in the console if the randomly selected movie is Jaws





// data types and return values (3pt)


// prompt('enter a number');


// whats the data type of the return value of the above function call


// write code to add 5 to the number user entered and log it on the console


Answered Same DayNov 22, 2021

Answer To: // Data Structures - Arrays (1 pt) // var pantry = [ // ['nutella', 'honey'], // ['pasta', 'rice',...

Kshitij answered on Nov 22 2021
111 Votes
Sol 1:
// Data Structures - Arrays (1 pt)
var pantry = [
["nutella", "honey"],
["pasta", "ri
ce", ["flour", "maple syrup"]],
];
// write code to log maple syrup in the console using the the pantry array above
console.log(pantry[1][2][1]);
Sol 2:
// loops (5pt)
// using a while loop print the following in the console:
// 17
// 15
// 13
// 11
// 9
// 7
// 5
// 3
// 1
for (var i = 17; i >= 1; i -= 2) {
console.log(i);
}
Sol 3:
// loop through the days array using a while loop to print the following in the console
var days = ["Thursday", "Friday", "Saturday", "Sunday"];
// 0 Thursday
// 1 Friday
// 2 Saturday
// 3 Sunday
for (var i = 0; i < days.length; i++) {
console.log(i + " " + days[i]);
}
sol 4:
// Objects & arrays (2pt)
// assume...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here