Posts

JavaScript Array method filter, map

JavaScript Array method filter, map Array.filter() The filter() method returns filtered elements in a new array which pass the condition define in callback method Syntax:      const newArray = array . filter ( function ( element , index , array ) {      return condition ;      }); Example:     const numbers = [ 1 , 3 , 6 , 9 , 12 ]; const luckyNumbers = numbers . filter ( function ( number ) { return number > 7 ; }); console . log ( luckyNumbers ); // Output: [9, 12] Array.map() The map() method creates a new array with the results of calling a function for each element of parent array. This method does not execute for empty element of array. Syntax:      const newArray = array . map ( function ( element , index , arr ), thisValue ) Example:                // Multiply all the elements of numbers array by 5 const numbers = [ 1 , 2 , 3 , 4 , 5 ]; const newArray = numbers . map (( item ) => { return item *

JavaScript Array methods introduced in ECMAScript 1

Image
JavaScript Array methods introduced in ECMAScript 1 Array.concat() The concat() method is used to join two or more arrays. This method does not change the existing arrays, but returns a new array with contains the value of merged arrays. Syntax: const new_array = array_1.concat(array_2, array_3, ..., array_n); Example: const one = ["a", "b"]; const two = ["c", "d"]; const three = ["e", "f"]; const result = one.concat(two, three); console.log(result); // Output: ["a", "b", "c", "d", "e", "f"] Array.join() The join() methods create a new string by concatenating all of the elements of in an array. The elements in the array will be separated by separator. The default separator is comma(,). This method does not change the original array. Syntax: const str = array.join(separator); Example: const nameArray = ["p", "r", "a

10 NodeJS Tips and Tricks for developers

Image
10 NodeJS Tips and Tricks for developers NodeJS is an open-source server side runtime environment built on Chrome's V8 JavaScript engine. It provides an event driven, non-blocking (asynchronous) I/O and cross-platform runtime environment for building highly scale-able server-side applications using JavaScript. Node offers many benefits including Low Memory Usage, Good Performance and Large Ecosystem of Packages currently numbering about 475000. 10 Tips to working in NodeJS 1. Use NPM packages To avoid reinventing the wheel use existing NPM packages when they are plug-able to your project. Below is the list of top 15 NPM packages used by developers. 1. React JS 2. Prop-types 3. Moment 4. Express 5. Request 6. Lodash 7. Async 8. Chalk 9. Commander 11. Debug 12. PM2 13. Mocha 14. Passport 15. Nodemailer 16. Mongoose 2. Use NPMS.IO to find packages To search NPM packages use NPMS.IO instead of using NPMJS.COM . npms.io is a replacement to the official npm

What is Deno and will it Replace NodeJS?

Image
What is Deno and will it Replace NodeJS? What is Deno? Deno is simple, modern and secure runtime for JavaScript and TypeScript , created by Ryan Dahl - the original creator of Node.js. The project is intended to fix design problems in Node.js described in Dahl's famous talk "10 Things I Regret About Node.js". 10 Things I Regret About Node. js — Ryan Dahl Not sticking with Promises He added promises to Node in June 2009 but removed them in February 2010 for minimal. It’s possible unified usage of promise in Node would have sped the delivery of the standardization and async/await. Security Node program can access all the system calls, such as writing to the disk, accessing to the network. The Build System (GYP) If you are writing a module links to a C library, you’d use GYP to compile that C library and link it into Node. Chrome used to use GYB, but now Node is the sole GYP user. Funky interface, it’s Python adaptation of JSON. Node has several unn

Top 5 Programming Languages to Learn in 2020

Image
Top 5 Programming Languages to Learn in 2020 The programming and developer communities are emerging at a rate faster than ever before. Various new programming languages are coming up that are suited for different categories of developers (beginners, intermediate, and experts) as well as for different use cases (web application, mobile applications, game development, distributed system, etc). Every beginner is puzzled with the question, "What programming language should I learn?" Let us take a look at best Programming Languages to learn in 2020 for a job and for future prospects: Why the top programming languages are so popular? We will take a look at five of the most popular programming languages to learn and why people love them. If you are starting your programming career in 2020 or if you want to learn your first or second programming language, then it is wise to learn one of the mainstream and established programming languages.  Worldwide Pro

Linux - VIM Editor Commands

Image
Linux - Vim Editor  Commands What is  VIM? Vim is a highly configurable text editor for efficiently creating and changing any kind of text. It is included as "vi" with most UNIX systems and with Apple OS X. MODES There are two different modes in VIM editor. Command Mode Move around the file Copy, Paste and Delete the text Insert Mode User can insert the text Change between the Modes Press  i  to get into Insert Mode. Press  Esc  (escape key) to exit form the Insert mode to Command Mode. Text Entry Commands -  a  Append text following current cursor position - A  Append text to the end of current line - i  Insert text before the current cursor position - I  Insert text at the beginning of the current line -  o  Open up a new line following the current line and add text there - O  Open up a new line in front of the current line and add text there Cursor Movement Commands -  h  Moves the cursor one character to the left -  l