Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

stringsandarraystris.js 802B

1234567891011121314151617181920212223242526
  1. //let bla = 'JavaScript'
  2. //console.log("The abbreviation for " + bla + " is " + bla.slice(0, 1) + bla.slice(4, 5))
  3. //let title = "title case";
  4. //console.log(title = title.slice(0, 1).toUpperCase() + "itle" + " " + title.slice(6, 7).toUpperCase() + "ase");
  5. //let practicefile = [42, "hello", false, -4.6, "87"]
  6. //console.log(practicefile)
  7. let cargoHold = ["oxygen tanks", "space suits", "parrot", "instuction manual", "meal packs", "slinky", "security blanket"];
  8. //cargoHold.splice(5, 2);
  9. //cargoHold.push("space tether", "security blanket");
  10. cargoHold[5] = "Space tether"
  11. cargoHold.pop();
  12. cargoHold.shift();
  13. cargoHold.unshift("1138");
  14. cargoHold.push("20 meters");
  15. cargoHold.splice(3, 0, "keys");
  16. cargoHold.splice(4, 1);
  17. //cargoHold.push("push");
  18. console.log(cargoHold + " " + cargoHold.length);