JAvascriptにおける文字列と文字列変数の問題
1752 ワード
var s = new String("hello");
s.indexOf(1) = 'p'; // ,indexof()
s[1]='p' // , c c++ ,
alert(s); // “hello”
var s = new String("Visit Microsoft!")
var a=s.replace(/Microsoft/, "W3School")
alert(a);
alert(s); // “Visit Microsoft!” ,
var s = "hello";
var a = new String ('hi');
alert(s);
alert(typeof(s)); // string
alert(typeof(s.length)) //number
alert(a);
alert(typeof(a)); //object