Note that there are some explanatory texts on larger screens.

plurals
  1. USKeen
    primarykey
    data
    text
    plurals
    1. COOn a convenience note, `event.keyCode ? event.keyCode : event.which` is equivalent to `event.keyCode || event.which`, even for non-Booleans.
      singulars
    2. CODoesn't each `.then()` create a new Promise object? If so, the new Promise qualifies as "Any object created within the method." Thus the Law of Demeter allows you to call methods on the new Promise, including yet another `.then()`. It depends on just how directly you require the object to be created within the method. Are you strict, qualifying only direct constructor calls? Are you more liberal, qualifying any object that only exists as a result of code executed within the method? I'd lean toward the latter, as the former distinction is highly arbitrary.
      singulars
    3. COThis code looks odd to me, but it's still valid JavaScript (albeit seemingly using global variables where it should be using local variables). And is that synchronous database access? As far as the question itself, since the only difference between the queries seems to be the color names, I might try storing the values in an object under property names equal to the color for the corresponding query: `var results = {}; var colorNames = ['RED', 'GREEN', 'BLUE']; each(colorNames, function (colorName) { results[colorName] = getValue(colorName); });`. Put your query logic in `getValue`.
      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