The following line is apparently written best in dot notation. I am trying to clean my JavaScript code to make it strict. What does it mean?
if (ie||ns6) { var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""; }
I added some context to my line of code, in case this helps? I know nothing about DOM. I am not trying to support Internet Explorer 4, this is not my code and I wouldn't be able to write JavaScript myself. I am only trying to get it compliant and the JSLint tool says about this line:
Problem at line 17 character 43: ['dhtmltooltip'] is better written in dot notation.
There are two ways to access properties of an object in JavaScript.
Dot notation
foo.bar.baz
Square bracket notation
foo['bar']['baz']
You are using the latter in part of your code.
Douglas Crockford, who wrote JSLint (a tool which gives that error message), is of the opinion that is is better to use dot notation where possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With