• Search form is empty!

  • 015 TypeScript - for loop

    http://robertdunaway.github.io

    TypeScript code kata list

    All code kata lists

    Smiley face

    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

    Kata

    Create a for loop using an incremental index.


    
        for (var index: number = 0; index < 10; index++) {
            console.log(index);
    
    


    Smiley face


    Imagine another for loop.


    
        var myNumber: number = 5;
        for (var multiplier = 1; multiplier <= 10; multiplier++) {
            var result = myNumber * multiplier;
    
            console.log(`${myNumber} * ${multiplier} = ${result}`);
        }
    
    


    Smiley face

    Next

    Take a few minutes and imagine more examples.

    Smiley face

    0 comments:

    Post a Comment