From 355f4c1366f155a3edc0d8088a32e228e3c2980b Mon Sep 17 00:00:00 2001 From: Neeru <161798182+neeru24@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:11:43 +0000 Subject: [PATCH] Commit Changes --- Array-Objects/02_Array.js | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Array-Objects/02_Array.js diff --git a/Array-Objects/02_Array.js b/Array-Objects/02_Array.js new file mode 100644 index 0000000..1e8ca3a --- /dev/null +++ b/Array-Objects/02_Array.js @@ -0,0 +1,42 @@ +const names = ["neeru", "dimp", "grace"] +const cartoon = ["shinchan", "doremon", "nobita"] + +//push +names.push(cartoon) + +console.log(names); +console.log(names[3][1]); + + +//concat +const allcartoon = names.concat(cartoon) +console.log(allcartoon); + + +//spread +const all_new_heros = [...names, ...cartoon] +console.log(all_new_heros); + + +//flat +const another_array = [1, 2, 3, [4, 5, 6], 7, [6, 7, [4, 5]]] + +const real_another_array = another_array.flat(Infinity) +console.log(real_another_array); + + +//isArray +console.log(Array.isArray("neeru")) + + +//Array.from +console.log(Array.from("neeru")) +console.log(Array.from({name: "neeru"})) // [] + + +//Array.of +let a = 100 +let b = 200 +let c = 300 + +console.log(Array.of(a, b, c)); \ No newline at end of file