每天CookBook之JavaScript-001

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>001</title>
</head>
<body>
	<div></div>
</body>
<script type="text/javascript">
console.log('this is a string');
console.log("this is a string");
console.log("This isn't a number.")
var city = new String("St. Louis");
console.log(city);
var lcCity = city.toLowerCase();
console.log(lcCity);
var city = String("st. Louis");
console.log(city);

var string1 = "This is a ";
var string2 = "test";

var string3 = string1 + string2;
console.log(string3);

var string1 = "This";
var string2 = "is";
var string3 = "a";
var string4 = "test";
var stringResult = string1 + " " + string2 + " " + string3 + " " + string4;
console.log(stringResult);

var oldValue = "apple";
oldValue += " and oranges";
console.log(oldValue);

var oldValue = "apple";
oldValue = oldValue + " and oranges";
console.log(oldValue);

var nwString = "".concat(string1, string2, string3, string4);
console.log(nwString);
</script>
</html>
posted @ 2016-07-03 22:35  4Thing  阅读(86)  评论(0编辑  收藏  举报