JavaScriptã§ã¯ããªãã¸ã§ã¯ããæ ¼ç´ããã¦ããå¤æ°ãä»ã®å¤æ°ã«ã³ãã¼ããã¨ããã®ãªãã¸ã§ã¯ãã¸ã®åç §ãã³ãã¼ãããã ãã®ãããå ã¨ãªããªãã¸ã§ã¯ãã®å¤ãå¤æ´ããã¨ãã³ãã¼å ã®ãªãã¸ã§ã¯ãã«ãå¤æ´ãåæ ããã¦ãã¾ããéãç¶ãã let obj1 = {value:'hoge'}; let obj2 = obj1; obj1.value = 'fuga'; console.log(obj2); // { value: 'fuga' } ã ãES2015ã§è¿½å ãããObject.assign()ã使ãã¨ãåç §ã§ã¯ãªãå¤ãã³ãã¼ã§ããã å¤ãåãã ãã®å ¨ãå¥ã®ãªãã¸ã§ã¯ããªã®ã§ãä¸æ¹ã§è¡ã£ãå¤æ´ã®å½±é¿ã¯ãããä¸æ¹ã«ã¯åã°ãªãã let obj1 = {value: 'hoge'} let obj2 = Object.assign({}, obj1); console.log(obj2);
{{#tags}}- {{label}}
{{/tags}}