Skip to content

Instantly share code, notes, and snippets.

@ceme
Created September 23, 2018 19:15
Show Gist options
  • Save ceme/d3540cc090eb65c9270abfd56f75ff75 to your computer and use it in GitHub Desktop.
Save ceme/d3540cc090eb65c9270abfd56f75ff75 to your computer and use it in GitHub Desktop.
Chain Map Filter Reduce and output to DOM : JavaScript / HTML / CSS
<div id="out"></div>
const x = [0,1,2,3,4,5,6,7,8,9]
.map((elm) => elm * 12)
.filter((elm) => elm > 42)
.reduce((sum, n) => sum += n)
document.querySelector('#out').appendChild(document.createTextNode(`Hello there: ${x}`))
* {
color: magenta;
font-weight: bold;
font: 1.3em "Open Sans", sans-serif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment