ES6 and Typescript Tutorial - 46 - Arrays and Tuples

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
Рекомендации по теме
Комментарии
Автор

Line 9 is incorrect --> Type '100' is not assignable to type 'undefined'

choudharymustansar
Автор

Could you please help me to resolve following error?

// tuples
let myTuples: [string, number] = ["Hello", 10];
myTuples[2] = 100;

Error:
Tuple type '[string, number]' of length '2' has no element at index '2'.

shaileshmishra
Автор

can we convert array to tuple in java script ? . for ex: array is ['firstname', 'lastname']. can we change it to tuple ('firstname', 'lastname')

satishtesting
Автор

myTuple[3] = true;
console.log(myTuple[3]); //logs true
Adding elements in a tuple seems fine even if they are not of the datatype specified in the initialization.
Can anyone please explain this?

saraswati