Browse Source

oef arrays

master
TristanC98 2 years ago
parent
commit
eb610bf08d
1 changed files with 36 additions and 0 deletions
  1. 36
    0
      exercise_Arrays.js

+ 36
- 0
exercise_Arrays.js View File

@@ -0,0 +1,36 @@
let PracticeFile = [273.15];
let Total = PracticeFile.push(42, "hello",[false, -4.6, "87"]);
console.log(PracticeFile);

let CargoHold = ['oxygen tanks', 'space suits', 'parrot',
'instruction manual', 'meal packs',
'slinky', 'security blanket'];

NewC = CargoHold.pop();
console.log(NewC);

NewShift = CargoHold.shift();
console.log(NewShift);
console.log(CargoHold);

CargoHold.unshift(1138);
CargoHold.push('20 meters');
console.log(CargoHold);

console.log('The array', CargoHold, 'has a length of', CargoHold.length,'.');


CargoHold.splice(3,0, 'keys');
console.log(CargoHold);

CargoHold.splice(4,1);
console.log(CargoHold);

CargoHold.splice(2,5, 'cat', 'fob', 'string cheese');

console.log(CargoHold);

let holdCabinet1 = ['duct tape','gum', 3.14, false, 6.022e23];
let holdCabinet2 = ['orange drink', 'nerf toys', 'camera', 42, 'parsnip'];

console.log(holdCabinet2.concat(holdCabinet1));

Loading…
Cancel
Save