Skip to the content.

Arrays Popcorn Hax 2

Second exercise for Arrays


Popcorn Hack #2 —


Create a length of a list and print it in console.log()


Create a variable called “list” or “my_list_2”
Create a list of numbers or words in the brackets [] Exp: let your_list = [3, 7, 9, 21];
Create a const length = your_list.length;
After all of that, finally print it out in console.log() Exp: console.log(your_list);

%%js   

let coolPeople = ["nigilekbam", "dumb mist", "west stefany", "jim", "aarav", "andrew", "tanay", "ruhaan"]; // create an variable 

const length = coolPeople.length; // create a const length

console.log(coolPeople.join(", ")); // print out your list in console
//style points!!!

coolPeople[4] = 'sigma boy' //direct replacement
console.log(coolPeople.join(", ")); 

coolPeople.splice(4, 1, "kid named finger") //splice replacement
console.log(coolPeople.join(", ")); 

<IPython.core.display.Javascript object>