Test yourself, or Do you really know JavaScript in SAP HANA XS?

Introduction:

In this article I would like to talk a bit about the possibilities xsjs which I did not find any documentation on scn, but which, in my opinion, would be useful to know those who study or work with SAP HANA XS about. The article is also dedicated to iterators, dynamic function arguments, easy way to copy objects, the Map object, a small example of currying, and an example of typed arrays.

Code, examples, explanation:

Definition of Iterator:

“An Iterator is an object that knows how to access items from a collection one at a time, while keeping track of its current position within that sequence. In JavaScript an iterator is an object that provides a next() method which returns the next item in the sequence. “

For better understanding Iterator just have a look at the following code:

And Object h2 – the new one – is clone, so when we change property am_i_copy – to 1 source h – doesn’t change. We couldn’t use JSON.stringify() and JSON.parse() because of functions..

The following example is a description of the Map() object. Map allows to operate the “key –value” pair. Here we create an array of values pairs ​​, and then we add to it the result of the method execution.

1 Comment

I reckon you’re looking for documentation in the wrong place. HANA XS uses SpiderMonkey, I’m not too sure what version it’s embedded in your server, but should be 24 (JS 1.8.5) — and since this is not an SAP ‘technology’, makes little to no sense looking into JS aspects in SDN.