PinnedWhat’s new in JavaScript/Node in 2021 | ECMAScript 2021JavaScript in 2021 provide some new features and flexibility to make JS developer life easy. let’s start — 1. Promise.any Syntax: Promise.any([p1, p2, p3]) Promise.any() is opposite of Promise.all(), it get resolved if any of Single promise get resolved. Example- Promise.any get resolved as any of promise get resolved , here promise…Ecmascript20213 min readEcmascript20213 min read
Apr 10Nest JS class-validators complex examples to make life easier in projectHello I am working in JavaScript related technologies from last 5+ years, currently working as Full stack engineer in a Cardekho, Product based company in India. From last 2 years, I started working In NestJS which is a typescript based framework. I developed 3 microservices using NestJs in a single…Nestjs4 min readNestjs4 min read
Mar 2, 2022Nest JS — Managing multiple connection solved— Master, Slave easily | Working solution | 2022 solutionIn NEST JS You can setup read/write replication using TypeORM. Now when u perform any write operation using repository it will use master config and read will use random slave config Example —Nestjs1 min readNestjs1 min read
Jul 25, 2021Polyfill of Promise.all()This question is asked in many JavaScript, Node, Angular, React.. interviews Why use Promise.all ? Promise.all is actually a promise that takes an array of promises as an input (an iterable). Then it gets resolved when all the promises get resolved or any one of them gets rejected. Promise.all([Promise1, Promise2…JavaScript1 min readJavaScript1 min read
Aug 29, 2020Easily print Pdf link in Javascript/Angular (Solved)We are going to use print.js library: https://printjs.crabbly.com/ 1. For Html/Javascript Project a) in HTML file define these links <link rel="stylesheet" type="text/css" href="https://printjs-4de6.kxcdn.com/print.min.css"> <script src="https://printjs-4de6.kxcdn.com/print.min.js"> </script> b) Now global method printjs is available printJS({printable:'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf', type:'pdf', showModal:true})Pdf Preview1 min readPdf Preview1 min read
May 10, 2020Design Patterns in Javascript /Node — 2020In this article, we are going to talk about design patterns that can be and should be used to write better, maintainable JavaScript code A design pattern provides a general reusable solution for the common problems occurs in software design. The underlying concept of design patterns has been around in…Js Design Patterns8 min readJs Design Patterns8 min read
May 9, 2020AWS Systems Manager (SSM) Parameters Store and Access using Lambda Function (Node/Javascript)What is AWS SSM: AWS Systems Manager Parameter Store provides secure, hierarchical storage for configuration data management and secrets management. You can store data such as passwords, database strings and license codes as parameter values. You can store values as plain text or encrypted data Some use cases — a…AWS Lambda3 min readAWS Lambda3 min read
Mar 17, 2020How to load ‘n’ number of images in HTML one by one using Javascript?Suppose there are 100 of images and you want to render them one by one in HTML. <html> <body> <div id="container"> </div> <script> const images = ['https://fakeimg.pl/300/', 'https://media.geeksforgeeks.org/wp-content/uploads/20190529122828/bs21.png', 'https://fakeimg.pl/400/', 'https://fakeimg.pl/100/']; const loadImages = (images) => { images.forEach((image) => { const img = document.createElement('img');Lazy Load Images1 min readLazy Load Images1 min read
Dec 14, 2019Javascript this? Understand in simple languageMany javascript developers either newbie or experienced developer confused with this. You will find all about this keyword in easy language What is this? In our natural language, we use this to refer to current Environment Objects: If a person sitting inside the house says: this address so it means…JavaScript4 min readJavaScript4 min read
Nov 19, 2019Convert local URL(URL) to Base64 in javascriptUse XMLHttpRequest() set responseType to Blob , use FileReader() at XMLHttpRequest onload event to read response as data URI var xhr = new XMLHttpRequest(); xhr.open("GET", "/path/to/local/image/file", true); xhr.responseType = "blob"; xhr.onload = function (e) { console.log(this.response); var reader = new FileReader(); reader.onload = function(event) { var res = event.target.result; console.log(res) } var file = this.response; reader.readAsDataURL(file) }; xhr.send()JavaScript1 min readJavaScript1 min read