Sunday, 25 June 2017

javascript - how to use substring function and what does this mean?

so i'm currently trying to figure out what the code below will output. I'm confused by the substr function so if you could explain that it would be amazing. Thanks





    function getAttackString() {
var foo = "d32329b34";

var bar = "x38h309hj";
return "The code is: "+(foo.substr(3,foo.length-6))+(bar.substr(2));
}

console.log(getAttackString());


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...