-3

I was going through a typescript code (with Angular 2) on website and I found following :

let episodesCopy = JSON.parse(JSON.stringify(this.episodes))

this.episodes=[...episodesCopy,this.otherEpisodes.pop()];

I want to understand whether operator ... in ...episodesCopy is a typescript operator or a javascript operator? and what exactly it does?

HeyItsMe007
  • 101
  • 2
  • 8
  • 4
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator – Alex K. Dec 18 '17 at 18:20
  • 1
    I was not aware of [...] operator is of Javascript. Even in my question I specifically mentioned about Typescript. What is the reason behind downvoting? – HeyItsMe007 Dec 27 '17 at 18:57

1 Answers1

2

That is the spread operator or spread syntax. It is essentially taking an expression (usually an array) and converting it into multiple statements.

ferronsays
  • 134
  • 4