Monday 13 May 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...