1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "Utf-8" />5 <title></title>6 <Scripttype= "Text/javascript">7 8 /*9 * Data type refers to the type of literalTen * A total of six data types in JS One * String Strings A * Number Value - * Boolean Boolean value - * Null empty value the * Undefined Not defined - * Object Objects - * - * Where string number Boolean Null undefined belongs to the base data type + * While object belongs to reference data type - */ + A /* at * String Strings - *-strings need to be quoted in JS - *-You can use double or single quotes, but don't mix - *-quotation mark cannot be nested, double quotation mark cannot put double quotation mark, single quotation mark cannot put single quotation mark - */ - varStr= 'Hello'; in - Str= 'I said: "It's a nice day today!" "'; to + - /* the in the string we can use \ as the escape character, * you can use \ to escape when representing some special symbols $ Panax Notoginseng \ "represents" - \ ' expression ' the \ n = line break + \ t Tab A \ \ Indicates the * */ + Str= "I said: \ \ \ \ \ \ "Today is a nice day!" \""; - $ Str= "\\\\\\"; $ - //output literal string str - //alert ("str"); the - //output Variable strWuyi //alert (str); the - Wu varstr2= "Hello"; - About str2= "Hello"; $ - str2= 3; - - alert (str2);//3 A + the </Script> - </Head> $ <Body> the </Body> the </HTML>
JS Base _ String