Extracting Domain Name from URLs: A Tutorial

function GET_DOMAIN(url){  let domain = ”;  let matches = url.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);  if(matches && matches[1]){    domain = matches[1];  }  return domain; } The given code defines a function called GET_DOMAIN that extracts and returns the domain name from a given URL. The domain name represents the network location of a website. The function follows these steps: To … Read more

Convert Values to Roman Numerals in Google Sheets with Custom Formula

Convert a number to its Roman numeral equivalent function TO_ROMAN(num){  if(typeof num !== ‘number’) return NaN;  let roman = ”;  const romanValues = {    M: 1000,    CM: 900,    D: 500,    CD: 400,    C: 100,    XC: 90,    L: 50,    XL: 40,    X: 10,    IX: 9,    V: 5,    IV: 4,    I: 1  };  for(let key in romanValues){ … Read more

Google Sheets: Extract Last Characters from String

Return the last number of characters of a string function LAST_VALS(str,num){  if(num >= str.length){    return str;  }  return str.slice(str.length – num); } The provided code defines a function called LAST_VALS that takes two parameters: str and num. The function returns the last num characters from the str string. Here is a detailed explanation of how … Read more

Google Sheets Formulas Examples and source code

Google Sheets Formulas Capitalize the first letter of each word in a given string function CAPITALIZE_WORDS(str) {  const words = str.split(‘ ‘);  for(let i=0;i<words.length;i++){    words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1).toLowerCase();  }  return words.join(‘ ‘); } The given code defines a function called CAPITALIZE_WORDS that takes a string str as an argument. The purpose of the function … Read more

Free Ebook Quick Guide to Advanced JavaScript 78pg ebook download here

What are the different data types in JavaScript? What is the difference between null and undefined in JavaScript? How does JavaScript handle asynchronous operations? Explain the concept of closures in JavaScript What are the differences between var, let, and const? What is hoisting in JavaScript? Explain the event delegation in JavaScript What is the difference … Read more

Explain the concept of “strict mode” in JavaScript.

“Strict mode” is a feature in JavaScript that enforces stricter parsing and error handling, aiming to make JavaScript code more robust, eliminate certain error-prone behaviors, and help developers write cleaner code. When strict mode is enabled, the JavaScript interpreter applies a set of rules and throws more errors in specific situations. To enable strict mode, … Read more