Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

a quick introduction to pipe and compose javascript

// pipe can be used to streamline the chaining of method calls
// Reference: https://www.freecodecamp.org/news/pipe-and-compose-in-javascript-5b04004ac937/
getName = (person) => person.name; // first method
uppercase = (string) => string.toUpperCase(); // second method
get6Characters = (string) => string.substring(0, 6); // third method
reverse = (string) =>
  string
    .split('')
    .reverse()
    .join(''); // fourth method
pipe(
  getName,
  uppercase,
  get6Characters,
  reverse
)({ name: 'Buckethead' }); // create a to do list of functions
// Output: 'TEKCUB'
Comment

PREVIOUS NEXT
Code Example
Javascript :: random number generator in hjs 
Javascript :: make the log do a jump in line js 
Javascript :: jquery checked 
Javascript :: font weight react native 
Javascript :: insta icon in next js 
Javascript :: javascript check if date is less than today 
Javascript :: react set title of page 
Javascript :: how to run react build locally 
Javascript :: js loop array 
Javascript :: how to set view engine in express 
Javascript :: js create date from string 
Javascript :: uniqid js 
Javascript :: check object has value 
Javascript :: react native textinput lowercase 
Javascript :: javascript clear symbols 
Javascript :: javascript array to comma separated string 
Javascript :: axios file upload 
Javascript :: run function once domcontentloaded javascript 
Javascript :: npm could not determine node.js install directory 
Javascript :: js delete element by id 
Javascript :: validar solo letras js 
Javascript :: angular input change event 
Javascript :: read data from json using node 
Javascript :: month name array javascript 
Javascript :: remove attribute javascript 
Javascript :: js add week to date 
Javascript :: angular build with configuration 
Javascript :: get payable amount ethereum solidity 
Javascript :: JavaScript Regex - Remove Whitespace from Start and End 
Javascript :: waypoint cdn 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =