• Search form is empty!

  • 014 TypeScript - interpolation

    http://robertdunaway.github.io

    TypeScript code kata list

    All code kata lists

    Smiley face

    014 TypeScript - interpolation

    Duration

    5 minutes

    Brief

    Using string interpolation

    For more information

    BING/GOOGLE: “TypeScript interpolation”

    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

    Replace the following with an interpolated string.


    
        var firstName: string = 'Bob';
        var career: string = 'programmer';
    
        var newString: string = firstName + ' is a ' + career + '.'
        console.log('classic string concatination');
        console.log(newString);
    
    


    The end result might look like this.


    
        var newInterpString: string = `${firstName} is a ${career}.`;
        console.log('string interpolation');
        console.log(newInterpString);
    
    


    Smiley face

    Next

    Take a few minutes and imagine more examples.

    Smiley face

    0 comments:

    Post a Comment