Apps Script Coding Examples FREE PDF Guide Download Now

Bullet code copy example of how you can copy a bulleted list from one Google Document to another using Google Apps Script: // Function to copy the bulleted list from one document to another function copyBulletedList() {   // Get the source document   const sourceDoc = DocumentApp.getActiveDocument();   // Get the list items from the source document … Read more

JavaScript interview questions with code examples

JavaScript interview questions with code examples closure in JavaScript What is closure in JavaScript and how can it be used to create private variables? A closure is a function that has access to variables in its outer scope, even after the outer function has returned. Closures can be used to create private variables in JavaScript … Read more

JavaScript Use Destructuring to get values from arrays and objects

https://www.linkedin.com/pulse/javascript-use-destructuring-get-values-from-arrays-objects-svekis- Destructuring is a feature in JavaScript Use Destructuring to get values from arrays Make use of destructuring to extract values from arrays and objects into variables: // Destructuring arrays const colors = [‘red’, ‘green’, ‘blue’]; const [first, second, third] = colors; // Destructuring objects const person = {   name: ‘John Doe’,   age: 30,   job: … Read more

Use forEach over for loop

Use forEach over for loop Prefer forEach over for loop for simple iterations: const numbers = [1, 2, 3, 4, 5]; numbers.forEach(number => console.log(number)); The forEach method is called on the numbers array. The first argument to forEach is a callback function, which is executed for each element in the array. The callback function takes … Read more