Results 1 to 3 of 3
  1. #1
    Banned Shadow@BWH's Avatar

    Badge

    Join Date
    Jul 2013
    Posts
    827
    Points
    912
         User Info     Contact     Gamer ID
    Join Date
    Jul 2013
    Posts
    827
    Points
    912
    Gamer IDs

    PSN ID: Shadow_PSNPlaza Wii Code: EmoBoy

    Default Substring Text (Console Log)

    Okay this is easy all you really need to know is place holders.

    Place Holder
    Code:
    0 1 2 3 4
     | | | | | 
     h e l l o
    Okay so we have the place holder's now were gonna move onto the actual code. You first start with console.log

    step 1.
    Code:
    console.log
    Step 2. Now add the word/words your making a substring with it would be "January" (Remember the quotations). So now the code looks like this

    Code:
    console.log("January"
    Step 3. Adding the substring. You need to put .substring tells the console what you are doing with said text. Now the code will look like this.

    Code:
    console.log("January".substring
    Step 4. Find the values of letter's. You want the first 3 letter's in January so the values would be 0-3. You would put that in brackets like this again telling the console the values of said word you want to see. (0,3) So now the code will look like this.

    Code:
    console.log("January".substring(0,3)
    Step 5. Closing the code. This is really important without it it will give you a syntax error. You use ); showing that that line is done. So now the finished code is this.


    Code:
    console.log("January".substring(0,3));
    Now it will show Jan instead of January.

    Other examples for tutorial

    Code:
    console.log("January".substring(0,3));
    console.log("Melbourne is great".substring(0,12));
    console.log("Hamburgers".substring(3,10));

    End result (Picture of the console log)


    0 Not allowed! Not allowed!

  2. #2
    Moderator chewtoys's Avatar
    Join Date
    Jun 2013
    Posts
    2,351
    Points
    3,397
         User Info     Contact     Gamer ID
    Join Date
    Jun 2013
    Posts
    2,351
    Points
    3,397

    Default

    Has anyone told Jan that Melbourne is burgers though?

    0 Not allowed! Not allowed!

  3. #3
    Banned Shadow@BWH's Avatar

    Badge

    Join Date
    Jul 2013
    Posts
    827
    Points
    912
         User Info     Contact     Gamer ID
    Join Date
    Jul 2013
    Posts
    827
    Points
    912
    Gamer IDs

    PSN ID: Shadow_PSNPlaza Wii Code: EmoBoy

    Default

    Lol I don't think so xD.

    0 Not allowed! Not allowed!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 05:18 AM.
Powered by vBulletin®
Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.