I have two string arrays in my typescript app:
public play: Array<string> = [];
public scene: Array<string> = ['gittare','saxsophone','drum'];
I want to push one element like 'gittare' to play array and remove it from scene element:
this.play.push('gittare');
console.log(this.play);
this.scene.splice(this.scene.indexOf('gittare'));
console.log(this.scene);
I expect in the console, I see the ['saxsophone','drum'], but it gives me [].
How can I fix it?
splice. Note carefully the description of what happens when the second parameter is omitted. Also, this has nothing to do with TypeScript. It's pure JavaScript as it has existed since the turn of the century.