How the let, const, and var Keywords Work in JavaScript

In JavaScript, we can declare variables in three different ways like this: It is best when you understand var, let, and const with these three concepts: Scope Reassigning a new value When you access a variable before declaring it These keywords differ in usage with respect to these concepts. Variable Scope in JavaScript In JavaScript,… Continue reading How the let, const, and var Keywords Work in JavaScript

Serverside promises

Promises are now supported serverside so you can now write asynchronous code. Example You can also create your own Promises now like so: Async functions (Async/Await) Async functions provide a way to structure and simplify your asynchronous code. It is useful to avoid callback that comes with Promises as it can get pretty complex. Example

ES6 Features to Adopt in SuiteScript 2.1

“let” keyword: This is basically a super local variable, it’s very useful for using them in for loops. Now you can have multiple nested for loops and declare all of your loop counter variables “i” and not worry about conflicts. Example Using var: var i = 5; for (var i = 0; i < 10; i++) {   // after last loop… Continue reading ES6 Features to Adopt in SuiteScript 2.1

encodeURIComponent

The encodeURIComponent() function encodes a URI by replacing each instance of certain characters with one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two surrogate characters). Compared to encodeURI(), this function encodes more characters, including those that are part of… Continue reading encodeURIComponent