Confirmed Javascript, #26 is broken


#1

// On line 2, declare a variable myName and give it your name.
var myName = "dre";
// On line 4, use console.log to print out the myName variable.
console.log(myName);
// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName = myName.substring(0,2);
// On line 9, use console.log to print out the myName variable.
console.log(myName);

I watched the youtube video where it worked. I tried putting it through a few ways. Even got the console to say the first 2 letters and still doesnt let me move on.


Question 26 on javascript
#2

confirmed not working on windows 8.1, with chrome

turned on my surface pro and the code was already entered... worked fine. Maybe clear the temp files to get it to work, not sure.


#3

Your code copied and pasted works on windows 7 with chrome, must be local with your cache or something


#4

// On line 2, declare a variable myName and give it your name.
var myName = "Amer";
// On line 4, use console.log to print out the myName variable.
console.log(myName);
// On line 7, change the value of myName to be just the first 2
// letters of your name.
var myName = myName.substring(0,2);
// On line 9, use console.log to print out the myName variable.
console.log(myName);

try like this, it worked for me :slightly_smiling:


#5

Please do not post full code without pointing out why it works. There has been a workaround found, so this is no longer a problem as far as I know, so please don't do this.

It's also against the community guidlines to post correct code without explanation.

Also, the code in the original post works, it just turned out to be an unknown problem within the user's browser or computer, not the code. This means that your post did not contribute to helping the problem. Sorry :confused:


#6

Sorry I didn't know :frowning:


#7

It's fine if you didn't know, just try not to do it again :stuck_out_tongue:


#8

Hi, Having the same problem as above threads. Is the Javascript #26 broken?
my code is exactly the same as Amer above but I keep getting TypeError: console.log is not a function. (In 'console.log(MyName)', 'console.log' is "Pa")


#9

i'm having the same problem and i cant find the solution!!!


#10

This is probably because you've written

console.log = something previously, which removes what console.log does

refresh the page and make sure none of your things are
console.log =
rather than console.log()

Refresh the page and try to submit then :slightly_smiling: