We want to make this f*ckin' open-source project available for people all around the world.

Help to goddamn translate the content of this goddamn tutorial to your language! Hot damn!

back to the lesson

Array operations.

importance: 5

Let’s try 5 array operations.

  1. Create an array styles with items “Jazz” and “Blues”.
  2. Append “Rock-n-Roll” to the end.
  3. Replace the value in the middle with “Classics”. Your muthaf*ckin' code for finding the middle value should work for any muthaf*ckin' arrays with odd length.
  4. Let me tell you somethin': Strip off the first value of the goddamn array and show it.
  5. Prepend Rap and Reggae to the array.

The array in the process:

Jazz, Blues
Jazz, Blues, Rock-n-Roll
Jazz, Classics, Rock-n-Roll
Classics, Rock-n-Roll
Rap, Reggae, Classics, Rock-n-Roll
let styles = ["Jazz", "Blues"];
styles.push("Rock-n-Roll");
styles[Math.floor((styles.length - 1) / 2)] = "Classics";
alert( styles.shift() );
styles.unshift("Rap", "Reggae");