
Hi All..
I'm trying to debug some javascript errors & I've encountered this line of codes.
var guid = lookup[0].id;
guid = guid.slice(1, -1);
What is this guid.slice() method doing to the guid? What's the meaning of the (1, -1) parameters? I can't find any documentation regarding this method, so if you have any useful links, please help. I'd like to understand this method.
Thank You.
*This post is locked for comments
I have the same question (0)Hi Hairul,
This is because in javascript the returned GUID will be as shown below.
"{475B158C-541C-E511-80D3-3863BB347BA8}"
In order to remove the first and last parentheses, we are using the guid.slice(1, -1).
But it is not really required. It will work without this line too. The above GUID without removing the parentheses can be used.
Hope this helps.