Use map when you want to change each value in the array based on some logic
var mappedArray = [2,4].map(number => number * 2)
console.log(mappedArray)
Use filter when you want filter out some values from an array based on some logic
var filteredArray = [1,2,3,4].filter(number => (number % 2 === 0))
console.log(filteredArray)
Use reduce when you want to reduce an array into a single resulting value
var reducedArray = [1,2,3,4].reduce((total,number) => total + number, 0)
console.log(reducedArray)
Cute reference: https://medium.com/@joshpitzalis/the-trouble-with-loops-f639e3cc52d9
Wednesday, June 7, 2017
Thursday, May 11, 2017
How do you debug a script file that is executed using NodeJS?
node --inspect --debug-brk index.js
Read more: https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27
Read more: https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27
What is Bash in Linux?
A nice article on Shell, Bourne Shell, Bourne again Shell that explains as simple as "Shell is the glue between you and the Kernell.". A must read: http://www.macdevcenter.com/pub/a/mac/2004/02/24/bash.html
Tuesday, April 25, 2017
Slideshow Using CSS and jQuery
I was looking for a simple solution to implement the slideshow of the images in one of my web sites. Found a simple solution here: https://css-tricks.com/snippets/jquery/simple-auto-playing-slideshow/. Simple and elegant!
Monday, April 3, 2017
Stock Market: Short Selling
In terms of Stock Market...Short selling is borrowing the shares from a company, and sell them &&& when the share prices are low, buy them from market and give them back to that company. Since you sold the shares at a high price and bought them at a low price and gave them back, you get to keep the difference.
Read this interesting article on TradeKing.
Read this interesting article on TradeKing.
Sunday, March 19, 2017
Wednesday, March 15, 2017
Responsive Web Design
Three things to be considered for Responsive Web Design:
- Fluid layouts
- Fluid Images
- CSS Media Queries
And I come across this nice web site where the author has explained all three of them with a simple example. A very nice job.
http://www.entheosweb.com/website_design/responsive_web_design.asp
http://www.entheosweb.com/website_design/responsive_web_design.asp
Subscribe to:
Posts (Atom)