JS101: Understanding Return Values for Method Chaining

> let a = 5; // returns undefined
> a // returns 5
> 'Hello'.toUpperCase().slice(2).charAt(2) // returns 'O'
> 'Hello'.toUpperCase().slice(2).charAt(2)
Return values: 'HELLO' > 'LLO' > 'O'
> 'Drink more water'.slice(11).toUpperCase().concat('world')
> 'Drink more water'.slice(11).toUpperCase().concat('world')
Return values: 'water' > 'WATER' > 'WATERworld'

--

--

--

Path from Ad Ops to Software Engineering

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to make your React Native app respond gracefully when the keyboard pops up

Common pitfalls: Creating a custom NPM package with React and TypeScript

Some of peer dependencies are set to “*”, any version, and some are locked at a particular version.c

What I Learned at Work this Week: Stitches

Writer of the Week: Lorenzo Zarantonello

[Action required] Your RSS.app Trial has Expired — Wed Jan 12 2022

Learn To Use Node.js With MySQL

Finding Black Squirrels in NY, a computer approach

webpack 4: Code Splitting, chunk graph and the splitChunks optimization

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Juan Juy

Juan Juy

Path from Ad Ops to Software Engineering

More from Medium

Topics for Interview: OOPS, C, C++

The Three Variables -Const Let and Var

House Robber Problem C easy to understand Sol

Time to know about the most commonly used string methods