string
length property
character at position 1
char code at position 10
first index of p
last index of p
String of characters 104, 105, 112
// sample-2-character.js // This sample shows String character methods function display() { var output1 = document.getElementById("output1"); var output2 = document.getElementById("output2"); var output3 = document.getElementById("output3"); var output4 = document.getElementById("output4"); var output5 = document.getElementById("output5"); var output6 = document.getElementById("output6"); var output7 = document.getElementById("output7"); // String object my_string_object = new String("hippopotomas"); output1.value = my_string_object; output2.value = my_string_object.length; output3.value = my_string_object.charAt(1); output4.value = my_string_object.charCodeAt(10); output5.value = my_string_object.indexOf("p"); output6.value = my_string_object.lastIndexOf("p"); // Note that fromCharCode is a static method. // It works with the String object, // not with my string object. output7.value = String.fromCharCode(104, 105, 112); }