accessing part of a variable using its index

you can access part of a string variable using its index[1]

Javascript

var my_string = "string";
var first_letter_of_my_string = my_string[0];
console.log(first_letter_of_my_string);

Demo

Other Items in javascript
Page Views

This page has been viewed 64 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹