Core JavaScript 1.5 Guide:Creating New Objects:Defining Getters and Setters - MDC é¢æ°ã®è¿ãå¤ãåãåããããããã£ãä»£å ¥ãããå¤ãå¼æ°ã«é¢æ°ãå®è¡ã§ããããããã£â¦â¦ã£ã¦ãã¨ã§ããã®ããªã setã®ã»ãã¯ä»£å ¥æ¼ç®åã®ãªã¼ãã¼ãã¼ãã£ã½ã使ãæ¹ãã§ãããã var niselocation = { get href() { return this._href; }, set href(x) { alert(this._href = x); }, }; niselocation.href = "http://www.example.com/"; // -> (alert "http://www.example.com/") console.log(niselocation.href); // -> http:/
{{#tags}}- {{label}}
{{/tags}}