Set Default Parameters for Your Functions, ES6 Courses on VIDEO
In this lesson we continue looking at arrow function syntax in ES6. We look at how default parameters work when we create functions in ES6. Similar to default parameters on older function declarations, we are able to declare a parameter and give it a value using the equal sign. If one does not add an argument when calling the function then the function will run and provide the default value that we gave the parameter. Giving our arrow function a default value may come in handy in certain instances, such as when one does not provide the information we ask for. Perhaps, upon the submitting of a form, one does not provide a field such as "name". If they do not provide a name, we could set a default value of "Anonymous".
Other Videos By We Will Code 2019-11-29 Write Concise Object Literal Declarations Using Object 2019-11-28 Create Strings using Template Literals, Learn JS ES6 2019-11-26 Use Destructuring Assignment to Pass an Object as a Function's Parameters,Learning Destructuring ES6 2019-11-24 Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements, Learn JS 2020 2019-11-23 Use Destructuring Assignment to Assign Variables from Arrays, Learning JS ES6 2020, Web Dev 2019-11-22 Use Destructuring Assignment to Assign Variables from Nested Objects, Learning the ES6 Syntax 2019-11-21 Use Destructuring Assignment to Assign Variables from Objects, An ES6 Course Introduction 2019-11-20 Use Destructuring Assignment to Extract Values from Objects, freeCodeCamp tutorials for ES6 2019-11-19 Use the Spread Operator to Evaluate Arrays In-Place, An ES6 Teaching 2019-11-18 Use the Rest Parameter with Function Parameters, freeCodeCamp Course on ES6 Syntax, Learn JS 2020 2019-11-17 Set Default Parameters for Your Functions, ES6 Courses on 2019-11-16 Write Arrow Functions with Parameters, freeCodeCamp's ES6 Course, ES6 Challenges FreeCodeCamp 2019-11-15 Use Arrow Functions to Write Concise Anonymous Functions, freeCodeCamp's ES6 Challenges, Javascript 2019-11-14 Prevent Object Mutation, ES6 freeCodeCamp Introduction, Learn Javascript in 2020, ES6 Syntax 2019-11-13 Mutate an Array Declared with const, 2020 ES6 Tutorials, freeCodeCamp ES6 Challenges 2020 2019-11-12 Declare a Read-Only Variable with the const Keyword, A freeCodeCamp ES6 Syntax Introduction 2019-11-11 Compare Scopes of the var and let Keywords, ES6 Intro FreeCodeCamp, Learn ES6 on FreeCodeCamp 2019-11-10 Explore Differences Between the var and let Keywords, Learn ES6, Intro to ES6, free Coding Tutorials 2019-11-10 Introduction to the ES6 Challenges, freeCodeCamp Intro to ES6 Challenges on FreeCodeCamp 2019-08-28 freeCodeCamp's Use tabindex to Specify the Order of Keyboard Focus for Several Elements 2019-08-24 freeCodeCamp's Use tabindex to Add Keyboard Focus to an Element, Accessible Web Apps 2020
Tags: default parameters in es6
es6 function parameters
learn es6 functions
freecodecamp es6 challenges