JavaScript Function Default Parameters

Опубликовано: 23 Июль 2017
на канале: Steve Griffith - Prof3ssorSt3v3
9,084
131

New in the ES6 version of JavaScript are default function parameter values. This is something that has existed in other programming languages for quite a while but is new to JavaScript.
We can now create optional parameters for function arguments. We always had the ability to declare a long list of parameters in a function declaration and the function would run even when those parameters were not provided in the call to the function. The downside was that all the unprovided parameters had a value of undefined.
Now we can provide a default value for any parameter, which means that we truly have optional parameters for functions.

REMEMBER: always put your optional values at the end of your list. JavaScript won't know if you meant to skip over a value. The default values should be last and the required values should come first.

Code GIST: https://gist.github.com/prof3ssorSt3v...


На этой странице сайта вы можете посмотреть видео онлайн JavaScript Function Default Parameters длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Steve Griffith - Prof3ssorSt3v3 23 Июль 2017, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 9,084 раз и оно понравилось 131 зрителям. Приятного просмотра!