Array (배열) [ ] square bracket!

Element

  • each value of index and separate with comma inside array

Index

  • order inside array and starts with ‘0’

Property

length

Method

list.push

  • add element to back **MUTABLE

list.pop

  • remove element from back **MUTABLE

list.shift

  • remove element from front **MUTALBE

list.unshift

  • add element to front **MUTABLE

Array.isArray

  • check whether it is array or not
  • if you use typeof, object and array show both as object

indexOf

  • check whether it is inside array and returns as index( first index at which a given element can be found in the array, or -1 if it is not present.)

includes

  • can check whether it includes or not
  • does not apply in internet explorer

arr.length === 0 or !arr.length

  • to receive empty array

splice(starting index, how many from starting index) ** MUTABLE

  • delete: delete index 0 and 1 represents delete

slice(startIndex, lastIndex) : *IMMUTABLE

  • last index will not include

concat:

  • merging arrays

Convert to Array from String 🤯

string.split():

  • split string with comma and conver to array

Convert to String from Array 🤯

for … of statement

  • for iterable object

join():

OBJECT (객체)

Dot Notation

  • need to use when key is changeable

Bracket Notation

  • need to put String inside bracket

key-value pair => Property

add value

delete value & key

  • if you delete value, it deletes key together!!

in

  • check values and returns as boolean

HOW TO ITERATE (객체 순회하기) 🤯

for … in statement

  • get key from object

Object.keys()

  • Make an array with key only

Object.values()

  • Make an array with values only

Object.entries()

  • Make an array inside array with key and value

console.table

Consistency achieves everything https://github.com/paigekim29