new 연산자를 피하라


Use {} instead of new Object()

Use "" instead of new String()

Use 0 instead of new Number()

Use false instead of new Boolean()

Use [] instead of new Array()

Use /()/ instead of new RegExp()

Use function (){} instead of new Function()


var x1 = {};           // new object

var x2 = "";           // new primitive string

var x3 = 0;            // new primitive number

var x4 = false;        // new primitive boolean

var x5 = [];           // new array object

var x6 = /()/;         // new regexp object

var x7 = function(){}; // new function object


source)

https://www.w3schools.com/js/js_best_practices.asp

Posted by SAP (Study And Programming) by serpiko

댓글을 달아 주세요

  1. 비밀댓글입니다

    2018.02.11 14:24 [ ADDR : EDIT/ DEL : REPLY ]