Today I will explain how to use javascript variable names with strings. In last session I explained how to create java script variables Previous Article
Now using variable how we can access the length of the variable; let’s check the below
Example

<script>
Var  Largedata = “My Name is EknowledgeTree”; 
//to calculate the length of the string we can use length property to display the length

Largedata.length; //which displays the string length
</script>

Now using length property we can compare the string length.let check it below

<script>

Var  largedataone = ”mynameiseknowledgetree”;
Var largedatatwo = ”getlatestarticlesateknowledgetree”;

Largedataone.lenght > largedatatwo.length
//here it will check whether the condition true or false and writes the output.
</script>

Here in the string character has position numbered index starts from “ 0”

<script>
 Var  largedataone =”Mynameiseknowledgetree I post new articles!”;

//Here the first character “M” is indexed as zero and after the long sentence there is space as indexed as 23 and last symbol “!” as 42.

Largedataone.length  // output 43
</script>

Since the index starts from zero ,but length value will always be one more then the last index.
Finding specific character using charAt() method .

Example below

<script>
Var  smalldata = “My Name is  Joe”;

Smalldata.charAt(6); //which will return output as “e”
</script>

Now we will see how to concatenate two strings in javascript

Example

<script>
Var message=”my name is joe,I am at the age ”;
Var age=28;

Var displayresults = message + ” of ”  + age;
//Now the above example returns the output message as below

// Output -- > My  name is joe, I am at the age of 28
</script>

Thanks for reading this article.