js only first 50 letters 1

js only first 50 letters

'Hiya how are you'.substring(0,50);

Here is what the above code is Doing:
1. We’re creating a variable called ‘my_string’ and assigning it the value of ‘Hiya how are you’.
2. We’re then calling the ‘substring’ method on the ‘my_string’ variable.
3. We’re passing two arguments to the ‘substring’ method. The first argument is 0, and the second argument is 50.
4. The ‘substring’ method will return a new string that is a substring of the original string.
5. The substring will start at the index of the first argument (0) and end at the index of the second argument (50).
6. The substring will not include the character at the index of the second argument (50).
7. The substring will be assigned to the ‘my_string’ variable.
8. The ‘my_string’ variable will now contain the value of the substring.

Similar Posts