Java


#1

For some reason its not recognizing that vaiable myCountry="USA" Any suggestions?
var myCountry = "USA"

// Use console.log to print out the length of the variable myCountry.
console.log("myCountry".length)

// Use console.log to print out the first three letters of myCountry.
console.log("myCountry".substring(0,3))


#2

console.log("myCountry".substring(0,3))

myCountry is a variable not string

so dont need " "



and remember java and javascript are not the same


#3

It should be (myCountry.substring(0,3)) because you are calling that variable and then performing the substring method on it. Also make sure to end everything with semicolons, that could be a problem if your not doing that in your actual program


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.