Author Topic: JS: how to write this in dot notation?  (Read 951 times)

rcjordan

  • I'm consulting the authorities on the subject
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16421
  • Debbie says...
    • View Profile
JS: how to write this in dot notation?
« on: September 28, 2016, 10:37:46 PM »
Code: [Select]
       return getStyle(node)["display"] == "none";
I'm getting the message ["display"]  is better written in dot notation in the editor.

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9325
    • View Profile
Re: JS: how to write this in dot notation?
« Reply #1 on: September 30, 2016, 04:07:52 PM »
I don't recognize that syntax I'm sorry to say.

It looks like you're using a function call to get the name of the object?


getStyle["display"](node) could be rewritten as getStyle.display(node) but I'm not sure what's going on there. Does this actually work?