main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
var the_name = "Luke Skywalker";

// access the string
console.log( "The name is " + the_name );

// access an attribute of the string
console.log( "The length of name is " + the_name.length );

// access a method of the string
res = "";
if ( the_name.indexOf( "Skywalker" ) === -1 ) {
    res = "not "
}
console.log( "This person is " + res + "from House Skywalker" );
Native Browser JavaScript