javascriptの参照と値

 javascriptの参照と値

javascriptの参照渡しと値渡しについて

Transcript

  1. 9.

    Pass by reference const A = {}; const B =

    A; B.x = 1; console.log(A); // { x: 1 }
  2. 10.

    Pass by value const A = 1; const B =

    A; B++; console.log(A); // 1
  3. 14.

    String behave like value let A = 'a'; let B

    = A; A += 'b' // Create new instance and assign to self. console.log(A); // 'ab'; console.log(B); // 'a;