What does dim highlighted properties of a JavaScript object signify in Chrome Dev tools? -


i wanted know properties of object when see in scope variables or hover on them(in chrome developer tools) appears dim highlighted. signify?

//sample code

'use strict'         function myclass(first, second) {             //            this.pehla = first;             var private_var = 'i_am_private_variable';             this.doosra = second;             object.defineproperty(this, 'pehla', { value: '_haani_constant', writable: false });          };          var instanceofclass = new myclass('1', '2');          console.log(instanceofclass.pehla);         console.log('assigning value pehla');         console.log("instanceofclass.pehla = 'someothertext' ");          try {             instanceofclass.pehla = 'someothertext';                                            } catch (e) {             console.log(e.message);          } 

see image reference

enter image description here

the properties not enumerable shown dimmed. reason confusion in answer defineproperty sets enumerable false default. hence property defined defineproperty dimmed unless enumerable explicitly set true in parameters.

try running following code test how different properties in devtools:

var test = {    prop1:"test",    prop2:"test",    prop3:"test", }; object.defineproperty(test,"other",{    enumerable:true }); object.defineproperty(test,"other1",{    enumerable:false });    object.defineproperty(test,"other2",{    writeable:false });     object.defineproperty(test,"other3",{    configurable:false });     console.log(test); 

and try running code below see properties enumerable:

for (i in test) console.log(i) 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -