Search code examples
javascriptoperator-keywordnotationshorthand

Sciter shorthand notation


I have encountered this notation shorthand in the array.reduce and object.sort functions in Sciter (http://www.terrainformatica.com/) :

array.reduce(:a, b: a + b)

object.sort(:a, b: a.start_time < b.start_time ? -1 : 1 )

I can pretty much guess what the parameters mean but I don't know for sure. How does this notation work?

Edit: Similar notation is used in Python. https://en.wikipedia.org/wiki/Anonymous_function


Solution

  • Apparently that's a lambda function syntax of the Sciter scripting language, which might be similar to JavaScript but is very different in this regard.