+ 7
var Jake = "Gybjo"; var Joke = Jake.substring(0, 4); https://code.sololearn.com/WaMjvuVF6fu0/#js
5th Oct 2017, 3:34 PM
AgentSmith
+ 11
var Jake = "Gybjo", Res = ""; for(var i = 0; i < Jake.length-1; i++) { Res += Jake[i]; } alert(Res); // EDIT -- Actually, @Netkos Ent has a better and simple way of doing it, of course.
5th Oct 2017, 3:31 PM
Dev
Dev - avatar
+ 7
@Forge Ice : I know its not for me, but you should use var e=jai.substring(0, x); instead of 'ja' so as to get the inner value of your <div>
6th Oct 2017, 10:19 AM
Dev
Dev - avatar
+ 4
@Forge Ice You're more than welcome bro. Btw, although the way I posted is the more efficient way, take a look at what Dev posted to you. It's a great example of how you can utilize loops to iterate through your string array, which is very useful for many other situations, so take note of what he did there and ask questions if you need to. So many ways of going about the same problems, and each way has its more useful scenarios, so obtain the knowledge from both methods. Best of luck!
5th Oct 2017, 3:38 PM
AgentSmith
5th Oct 2017, 4:15 PM
Antony O. Onyango
Antony O. Onyango - avatar
+ 1
@Netkos niiice!! ive got to know what that substring () does... thats very few lines.. Im still new to JS :'(
5th Oct 2017, 4:17 PM
Antony O. Onyango
Antony O. Onyango - avatar
0
or u can just tell me here :)
5th Oct 2017, 4:18 PM
Antony O. Onyango
Antony O. Onyango - avatar