Ramatou Adamou Issa

Ramatou Adamou Issa

  • Experiences
  • Formation
  • Musics
  • Blog

›Recent Posts

Recent Posts

  • Watchtower, container for updating docker images
  • PHP8 (Migrating existing PHP7 project to PHP8)
  • What news in Symfony 5
  • Command Query Segregation Responsibility (CQRS)
  • AFUP conference feedbacks

ES6 - Spread Operator && Arrow Function

May 7, 2019

Nicolás Bevacqua

Spread operator

Rest operator in function


    function foo(...spreadParam) {}  
     

Rest operator in function with few parameters


    function foo(param1, ...spreadParam) {}     

For more examples continue reading this article here

Arrow Function

Arrow function is a new way to declare a function in ES6

Simple example


    param => returnValue    

Simplify call in some functions like map

    array.map(value => value * 2)     

Object return, wrap the return with parenthesis


    param => ({returnObject})     

Zero or several params


    () => returnValue   
    (...severalParam) => ({}objectReturn)    

Multiple statements in the function


    () => {} //use brackets 

Code block do not have implicit return at the end

This Binding in array functions


The

    This    

in the arrow function is the same as the context. It can't be modify with .apply or .call

See all more examples here

Tweet
Recent Posts
  • Spread operator
  • Arrow Function
Ramatou Adamou Issa
Ramatou Adamou Issa
HomeExperiencesFormation
Social Networks
InstagramTwitterChat
Accounts
Gallery photoBlogGitHubStar
Copyright © 2025 Ramazaki