Learning Javascript

What data types can you store inside of an array?

Is the people array a valid Javascript array? If so, how can i accss the values stored? If not, why?

const people = [['pete', 32, 'librian', null], ['smith', 40, 'accountant', 'fishing: hiking: rock_climbing'], ['bill', null, 'artist', null]];

Yes this is a valid array and it can be accessed by first deciding which cell you wish to access such as 0 being the first, keep in mind all arrays start off at the number 0 for access. So [0] would access the first item in the whole array, which is the first bracket of information then we would select an array item between 0 and 3 so if we wanted librarian we would do select the array known as people([0][2]). This will access the first cell in the overall array which holds a second array, and the 2 will access the third item in that array.

List five shorthand operators for assignment in javascript and describe what they do.

let a = 10; let b = 'dog'; let c = false; evaluate (a+c) + b; The overall result would be 10dog because there is no conditional reasoning to justify a callback to anything being false or true, so while it may technically add all of the elements above, false is not a value that can be displayed without any form of conditional actions to give true or false.

Describe a real world example of when a conditional statement should be used in a javascript program.

An obvious answer to this would be based on a user input is where a conditional statement should be used. If the user does X action run X code, else if user does Y instead run Y code instead.

Give an example of when a loop is useful in javascript.

Loops are useful for when you want a specific set of code to run until a certain condition is met. For example if a user doesn't input the right password then keep asking for the right password until it's entered correctly or a limit of attempts is reached.