what exactly is the question?
hey guys, I don't actually know whether this is supposed to be in this forum or not. anyways, here is the code and how it looks like if opening it in the browser. im a total noob so don't be triggered XD im trying to get a space between the vars.
Code:var r1 ="999999999999999999999999999999999999999999999999999999999999999999999"; // makes var with numbers var l1 = r1.length; // makes a var. it doesnt calculate it just counts the length of the numbers. this is 69 because there are 69 9's document.write(l1); // it writes it on your screen/executes the code? im not sure what is this im 12 var r2 ="moop"; // makes a var with letters by using "" i think. i still use it for numbers aswell anyway. var s1 = r2.substring(1, 4) // it only starts showing from the second letter to the fourth. that will make oop document.write(s1); // same as the above. only its a different var
Thanks
- - - Updated - - -
It might be hard to read the code btw, but I attached another image so you can easily see the problem and the code
- - - Updated - - -
still looking for answers
Last edited by doger057; 06-11-2019 at 01:32 PM.
what exactly is the question?
What do you mean by space? the space in javascript is this " "
well, im noob so i dont even know it that well,
but since i used length, adding a space to the number that displays wont matter, since then it will simply show 70 instead of 69
im probably looking for a space that doesnt actually count with length. so i will have a space between 69 and oop yet it shouldnt change the 69 to 70
- - - Updated - - -
maybe that could work, but ill search first on how I should use it since I don't actually know how.
since I have tried using it real quick but everywhere I place it, whatever comes after   doesn't display?
Last edited by doger057; 06-15-2019 at 11:59 AM.
oohh, now i understand what u want xD sweet
i think you are trying to do that:
if u want to create a "line feed" you have to replace " " with "<br>"Code:var r1 ="999999999999999999999999999999999999999999999999999999999999999999999"; var l1 = r1.length; var r2 ="moop"; var s1 = r2.substring(1, 4); document.write(l1 + " " + s1);
Mike was correct sorry didn't understand the question
and yes <br> is line feedCode:document.write( "+(var1)+ " " + (var2)+ " " + (var3)+"); /* another way
With ES6 we have what we call Template Strings. It is the same logic but mor readable. Example
And you can do logic tooCode:const name = "John"; console.log(`Hello, ${name}!`); // Prints: Hello, John!
Good codingCode:console.log(`I am ${2019-1991} years old.`); // Prints: I am 28 years old.