Lesson 23


...So much headache for this:

// Use console.log( ) to print out the substrings.
// Here is an example of the 1st to 4th letter of "JavaScript":
// console.log("JavaScript".substring(0,4));
console.log("January".substring(0, 3 ) );
console.log("Melbourne is great".substring(0, 13 ) );

I just take "hamburgers" step by step with cursor and think about this:
0h1 1a2 2m3 3b4 4u5 5r6 6g7 7e8 8r9 9s10
Also at half of the word I got stucked. And I repeated procedure in mind :smile:
Even now I can't think clear about this concept. It just give me headache to think about second number.



With a google search in the =dicussions / opinions=
you could get a better feel of the SYNTAX

== discussions / opinions ==
javascript substring() explained site:stackoverflow.com
= http://stackoverflow.com/questions/3745515/what-is-the-difference-between-substr-and-substring


The first js call-to-print will print: Jan
The second line will print: Melbourne is gr
The third line will print: mburgers

You want the second letter of any string to be printed do this:

console.log("January".substring(0, 2 ) );
console.log("Melbourne is great".substring(0, 2 ) );
console.log("Hamburgers".substring(0, 2));

If you still get an error on codeacademy copy all your code, exit the page and then revisit the whole topic afresh. You will see all previous code printed...so delete it and paste the code you copied!



What @josephgodwinke,
is pointing at, is the second-possible =reset=

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser


Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


i have had problems with january i think i have done it right it comes up with jan but it says i did not pick the right substring


You should be getting Jan - note the uppercase "J".