In this blog, you’ll learn how to document your JS/TS code, how to give more context to your functionalities using JSDoc, and how to generate documentation files using Typedoc. Setting up the project Create a new project using npm: > npm init -y For this blog, it contains 3 files: src/app.js src/models/user.mjs src/models/todo.mjs Then update… Continue reading Learn how to document JavaScript or TypeScript code using JSDoc & Typedoc
Tag: javascript
Async vs Defer in JavaScript: Which is Better?
This article will explore an interesting Javascript topic. async and defer are attributes used when including external JavaScript files in HTML documents. They affect how the browser loads and executes the script. Let’s learn about them in detail. Default Behaviour We generally connect our HTML page with external javascript with <script> tag. Traditionally, JavaScript <script> tags were often placed in the <head> section of the… Continue reading Async vs Defer in JavaScript: Which is Better?
A Method Set a Minimum and maximum limit based on array length (JavaScript)
In this method we can use the following code , if we want to iterate a loop maximum to 5 iterations and a minimum of the length of a particular array in the code. Code snippet: var maxIterations = Math.min(array.Length, 5);
JavaScript code to close the current page and reload the parent page after a time delay.
// Set the time delay in milliseconds (e.g., 3000 milliseconds = 3 seconds) const timeDelay = 3000; // Close the current page after the time delay setTimeout(() => window.close(), timeDelay);// Close current page setTimeout(() => window.opener.location.reload(), timeDelay);// Reload the parent page
Metaprogramming in Javascript
Metaprogramming develops as a strong paradigm that goes beyond ordinary execution, allowing programmers to change programs as they execute. This allows apps to behave dynamically, produce code fragments at runtime, and even create unique data structures with specific functions. Some important tools in this space are the Reflect API, which makes object manipulation easier, proxies… Continue reading Metaprogramming in Javascript
Determine if Users’s Netsuite Account is a OneWorld/Non-OneWord Account by SuiteScript
Scenario User would like to determine if NetSuite account is One-World by using SuiteScript Solution A unique identifier of a OneWorld Account is the use of Subsidiaries which are not available otherwise. Below are two other methods to determine whether an account is OneWorld or not via scripting: Server Side Script: var isOneWorld; var companyInfo = nlapiLoadConfiguration(‘userpreferences’); //gets… Continue reading Determine if Users’s Netsuite Account is a OneWorld/Non-OneWord Account by SuiteScript
Temporal : Supporting Calendar Systems in Temporal
ECMAScript Temporal is the new date and time API for ECMAScript. Because ECMAScript is designed for global audiences, high-quality internationalization is a design goal. This document discusses why and how calendar systems are included in the Temporal API, explains problems we expect developers to encounter with calendars, and outlines how to avoid those problems. A final… Continue reading Temporal : Supporting Calendar Systems in Temporal
Temporal : Temporal.Calendar
A Temporal.Calendar is a representation of a calendar system. It includes information about how many days are in each year, how many months are in each year, how many days are in each month, and how to do arithmetic in that calendar system. Much of the world uses the Gregorian calendar, which was invented in 1582 C.E. On… Continue reading Temporal : Temporal.Calendar
Temporal: Duration Balancing
Duration Balancing With most types in Temporal, each unit has a natural maximum. For example, there is no such time as 11:87, so when creating a Temporal.PlainTime from 11:87 the time is either clipped to 11:59 (“constrain” mode) or an exception is thrown (“reject” mode). With Temporal.Duration, however, maximums are less clear-cut. Take, for example, a duration of… Continue reading Temporal: Duration Balancing
Temporal : Time Zones and Resolving Ambiguity
Understanding Clock Time vs. Exact Time The core concept in Temporal is the distinction between wall-clock time (also called “local time” or “clock time”) which depends on the time zone of the clock and exact time (also called “UTC time”) which is the same everywhere. Wall-clock time is controlled by local governmental authorities, so it can abruptly change. When… Continue reading Temporal : Time Zones and Resolving Ambiguity