Skip to main content

Posts

Javascript

Question : example of Map Reduce Answer : (() => { let aNumberArray = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] ; let sum = aNumberArray. map (data => data * 2 ) . reduce ((ongoing , data) => ongoing + data) ; console . log (sum) ; })() Question : What is IIFE? Answer  : Immediately Invoked function expression e.g. (function(){}()). usually pronounces as " effy ". Question : Why the script tag should be added at the bottom or before the end of the body tag? Answer  : It helps the html page to render quickly without even downloading the script which may be getting downloaded from the slow CDN. there are other alternative like async and defer as well, which are supported primarily on new browsers.     <script src="bower_components/angular/angular.min.js" defer></script>     <script src="bower_components/jquery/dist/jquery.min.js" defer></script>     <script src="bower_components...

ExpressJS

What is expressJS? Answer : Express is a relatively small framework that sits on top of Node.js’s web server functionality to simplify its APIs and add helpful new features. It makes it easier to organize your application’s functionality with middleware and routing; it adds helpful utilities to Node.js’s HTTP objects; it facilitates the rendering of dynamic HTML views; it defines an easily implemented  extensibility standard. This book explores those features in a lot more depth, so all of that lingo will be demystified soon. What Express is used for ? Answer : In theory, Express could be used to build any web application. It can process incoming requests and respond to them, so it can do things that you can do in most of the other frameworks mentioned earlier. Express is often used to power single-page applications (SPAs). SPAs are very JavaScript-heavy on the front end, and they usually require a server component. The server is usually required to simply serve the HTML, CSS, and ...