Hey Coders!! 👩💻
And in Part-1 we had learned about Printing Statements, Variables in JS and Arithmetic Operators. Remember??
And in Part-2 we had learned about Incrementing numbers, Decrementing numbers, Shortcuts :(*=, /=), Add 1 to number, Escape sequences in strings🎃
If you have not seen my Part-1 and Part-2 go watch now because in that 2 articles we have talked about the basic things in JS!😀
Concatenating strings with plus operator 🎓
var myStr = "Hi I am amena," + " How are you?" console.log(myStr)
Concatenating strings with plus equals operator🎩
- We can also get an output with the plus equals operator.
var bat = "This is my bat " bat += "and this is my ball" console.log(bat)
Constructing strings with variables📌
var firstCode = " my first coding language was Python." var askingYou = "Hi my name is Amena," + firstCode + " What was yours?" console.log(askingYou)
So the activity for you is you need to output: Twitter is awesome But with a twist! I want you code with me!!💙
Step 1: Make a variable name it
myStr, inside this write
Step 2: Make another variable name it
ourStrinside this write
Step 3: Now, I want an output as
Twitter is awesome!but you must use
BEST OF LUCK!💛
Find Length of string🎗
To find the length of the string JS has the special operator called
var code = "Coding is fun" console.log(code.length)
- Here we're getting
13because it counts the
spacesalso and also it starts with
0, 1, 2, 3.....
Bracket Notations to find the characters of strings🎲
Bracket Notations to find the last letter!🛒
If you'll just write
-1 after the strings then you must get the last letter of the string 👆👆
Similarly if you write-2
then you'll get the second last letter of the string.
Hopefully you are done with the length part!!💚
So, now there is a deal, that you need to write this all and try to understand because, if you just see it you cannot learn it. Hopefully you'll do it!!❤
Motivation for today: Talk is cheap, Show me the code👨💻
If you guys found this article useful comment 🚀🚀🚀!!