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

75 views
Skip to first unread message

haa...@gmail.com

unread,
Apr 7, 2014, 12:31:31 AM4/7/14
to google-chrome-...@googlegroups.com
Hi all,

I wanted to know that some properties of the object when we see in scope variables or hover over them(in Chrome developer tools) appears to be dim highlighted. What does it 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 to pehla');
        console.log("instanceOfClass.pehla = 'SomeOtherText' ");

        try {
            instanceOfClass.pehla = 'SomeOtherText';                                   
        } catch (e) {
            console.log(e.message); 
        }

'pehla' property is dim highlighted as compared to 'doosra'

I have even asked on stackoverflow, however I am not fully satisfied with the answer.Please have a look in below link.

http://stackoverflow.com/questions/22895993/what-does-dim-highlighted-properties-of-a-javascript-object-signify-in-chrome-de

Thanks in Advance.

Syed Haani Hasan





Vsevolod Vlasov

unread,
Apr 7, 2014, 3:45:24 AM4/7/14
to Google Chrome Developer Tools
The properties that are not enumerable are shown as dimmed. The reason for confusion is that defineProperty sets enumerable to false by default. Hence the property defined with defineProperty is dimmed unless enumerable is explicitly set to true in the parameters.

I'll add this as an answer on StackOverflow.

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/2d0187da-7034-4f42-a792-3fac3c3ce84b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages