ES6 and Typescript Tutorial - 13 - Rest Operator

preview_player
Показать описание

📱 Follow Codevolution

ES6 | ES2015 | Typescript | ES6 Tutorial | ES2015 Tutorial | Typescript Tutorial | ES6 Tutorial for Beginners | ES2015 Tutorial for Beginners | Typescript tutorial for Beginners
Рекомендации по теме
Комментарии
Автор

Thank you. This also implies there is no function overloading in javascript, right?

alter-ego-
Автор

thanks, video title should be named as Rest parameters

premg
Автор

What is the use of this rest and spread operator in real time environment

gowthamdanthuluri
Автор

Those who are getting errors at function parameters
In your tsconfig.json file set the parameter "noImplicitAny": false

PradumnyaGhadole
Автор

'arguments' vs ...colors
no function overloading in javascript

vigneshgvs
Автор

error TS2554: Expected 0 arguments, but got 1.

nishantdwivedi
Автор

My code :-
let displayColors = function(){
console.log(message);
for(let i in arguments){
console.log(arguments[i]);
}
}


let message = "List of Colors";


displayColors('Red');
displayColors('Red', 'Blue');
displayColors('Red', 'Blue', 'Green');


output:-
List of Colors
Red
List of Colors
Red
Blue
List of Colors
Red
Blue
Green
My question is, I am not passing message variable to that function. How it's working fine. "let" are works with blocks only right?. I am using Scratch js add on for this tutorial.

yasirasarudheen
Автор

let displayColors = function(){

console.log(message)
for(let i in arguments){
console.log(arguments[i]);
}
}

let message = "List of colors";

displayColors(message, 'Red');
displayColors(message, 'Red', 'Blue');
displayColors(message, 'Red', 'Blue', 'Green');



This gives error
Expected 0 arguments, but got 3.ts(2554)
but still compiles and run but my output is
Red
undefined
Red
Blue
undefined
Red
Blue
Green
undefined

Why the message is coming as undefined
Thanks in advance!

athulliapaulose