23 "More Sub Strings"


#1

Hey Folks hope you are doing well on your various things here is my problem.

Objective is:
Using console.log, on three separate lines, print out the substrings for the following strings.

a. "Jan" in "January"
b. "Melbourne is" in "Melbourne is great" (note the space!)
c. "burgers" in "Hamburgers"


What I believe to be correct.

console.log("January".substring(0,3));
console.log("Melbourne is Great".substring(0,10));
console.log("Hamburgers".substring(3,10));


I would love the answer but most imprtantly I want to understand the flaw in my thinking.

Thanks In Advance :smiley:


#2

"Melbourne is Great".substring(0,10)

Why 10? "Melbourne" has only nine letters, right?


I had misread instructions, @mtf is right :slight_smile:


#3

Melbourne is has twelve letters.


#6