Category: Javascript

  • C# LINQ methods and their JavaScript equivalents

    Here’s a breakdown of common C# LINQ methods and their JavaScript equivalents, including Sum and Avg: Filtering (Where): Both methods filter the collection based on a condition. The condition is specified in an arrow function in JavaScript. Finding First Match (Find): Both methods return the first element that matches the condition. If no match is…

  • The Difference Between Values and References in JavaScript

    In JavaScript, how variables store data can be a bit tricky. It all boils down to the difference between values and references. Primitive Data Types (Values): These data types hold the actual value themselves. When you assign a primitive value to a variable, a copy of that value is stored in memory. So, if you…

  • 10 JavaScript Console Methods

    Besides console.log, this useful object, an important help for programmers has several methods which offer more than simple logging. console.clear console.count console.table console.group and console.groupEnd console.assert console.time and console.timeEnd console.memory console.trace console.dir console.log , example with css: console.log(“%c logging”,”color: #ff0000; background: #ffffff; font-size: 20px; padding: 25px”) Resource: https://www.c-sharpcorner.com/article/10-javascript-console-tricks-that-you-may-not-know/ Another super cool article: https://www.sitepoint.com/beyond-console-log-level-up-your-debugging-skills/ #javascript #console…

  • Executing code in intervals with…

    Executing code in intervals with JS: setTimeout() and setInterval() There are two ways you can execute the code in intervals with JS, but which one to use? How do recursive setTimeout() and setInterval() differ? The difference between the two versions of the above code is a subtle one. Recursive setTimeout() guarantees the same delay between…

  • BrowserSync, Gulp and TypeScript

    I was creating a simple web app with VueJS (without cli, no single file component) and I thought it would be good to have a local server which watches changes, auto-transpiles TypeScript and later maybe builds(minify, terser, copy files etc.) for the production. By using BrowserSync & Gulp, a typescript project can be easily watched,…

  • Compiling vs Transpiling

    A question that I heard recently: Compiling vs Transpiling  It seems that Wikipedia has enough information as well: “A source-to-source compiler, transcompiler or transpiler is a type of compiler that takes the source code of a program written in one programming language as its input and produces the equivalent source code in another programming language.…

  • Reverse an array

    You know there is array.reverse() function, sharing the snippet below just in case wondering how to do it. We iterate half of the lentgh, guess why? #array #typescript #javascript