Note that there are some explanatory texts on larger screens.

plurals
  1. USEmpish
    primarykey
    data
    text
    plurals
    1. COBut I'm still left wondering why - if the language itself recognizes an object's `typeof` correctly, and the IDE is able to understand the language, then why can't a function's parameters be highlighted according to their type? To add to my confusion, as I was typing up my example, I realized that for the function call in IntelliJ's IDEA, by default, it DOES highlight the string and number parameters differently than the function parameter. So why can't it do the same for the function definition itself?
      singulars
    2. COExample code: var aString = "forty-two"; var aNumber = 42; function aFunction() {/* empty function */;} function testFunctionParameters(aS, aN, aF) { console.log(" "); console.log(aS); console.log(typeof aS); console.log(aS.elements); console.log(" "); console.log(aN); console.log(typeof aN); console.log(aN.elements); console.log(" "); console.log(aF); console.log(typeof aF); console.log(aF.elements); console.log(" "); } testFunctionParameters(aString, aNumber, aFunction);
      singulars
    3. COSo I've been trying to wrap my head around your comment and it's implications, but I can't get .elements to work. I believe the reason I can't get it to work is that it is specifically related to the DOM, which is in turn specifically related to HTML. While my question initially used a browser viewable code, and thus had aspects of html, none of the code in question is directly related to HTML. So I wrote up a javascript only example (in other words browser & html-free example). That example is the next comment in this thread.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload