http://robertdunaway.github.io
TypeScript code kata list
All code kata lists
015 TypeScript - for loop
Duration
5 minutes
Brief
Using the “for” loop.
For more information
BING/GOOGLE: “TypeScript for loop”
Instructions
Get tutorial folder or the entire katas-typescript repo.
Open the [before/*.sln]
file and execute the kata.
Feel free to execute this kata multiple times because repetition creates motor memory.
Github
- Before (start kata with this)
- After
Kata
Create a for loop using an incremental index.
for (var index: number = 0; index < 10; index++) {
console.log(index);
Imagine another for loop.
var myNumber: number = 5;
for (var multiplier = 1; multiplier <= 10; multiplier++) {
var result = myNumber * multiplier;
console.log(`${myNumber} * ${multiplier} = ${result}`);
}
Next
Take a few minutes and imagine more examples.
0 comments:
Post a Comment