var $a = 10;
var a = 3.14;
var string = "I am Yanly";
var notDefined;
var noSpace = null;
var isReal = true;
document.write($a + "<br/>");
document.write(a + "<br/>");
document.write(string + "<br/>");
document.write(notDefined + "<br/>");
document.write(noSpace + "<br/>");
document.write("--------------------------------------------------------------------------------------------------------------<br/>");
var number1 = 11;
var number2 = 22;
var sum = number1 + number2;
var string1 = "Hi!";
var string2 = "Yanly";
var number1string1 = string1 + number1;
var number2string2 = string2 + number2;
var string1string2 = string1 + string2;
var number1string = number1 + "";
var stringnumber1number2 = number1string1 + number2;
document.write(sum + "<br/>");
document.write(number1string1 + "<br/>");
document.write(number2string2 + "<br/>");
document.write(string1string2 + "<br/>");
document.write(sum + "<br/>");
document.write("--------------------------------------------------------------------------------------------------------------<br/>");
//赋值运算符
var a = 1;
var b = 2;
document.write(a + "<br/>");
document.write(b + "<br/>");
a += b;
document.write(a + "<br/>");
a -= b;
document.write(a + "<br/>");
a *= b;
document.write(a + "<br/>");
a /= b;
document.write(a + "<br/>");
document.write("--------------------------------------------------------------------------------------------------------------<br/>");
//比较运算符
var larger = (1+2) > (2+3);
document.write(" (1+2) > (2+3) : " + larger + "<br/>");
var smaller = (1+2) < (2+3);
document.write(" (1+2) < (2+3) : " + larger + "<br/>");
var larger = (1+2) < (2+3);
document.write(" (1+2) < (2+3) : " + larger + "<br/>");
var smaller = (1+2) < (2+3);
document.write(" (1+2) < (2+3) : " + larger + "<br/>");
var largerequal = (1+2) >= (2+3);
document.write(" (1+2) > (2+3) : " + largerequal + "<br/>");
var smallequal = (1+2) <= (2+3);
document.write(" (1+2) < (2+3) : " + larger + "<br/>");
var equal = (2+2) == 4;
document.write(" (2+2) == 4 : " + equal + "<br/>");
var notequal = (2+2) != 4;
document.write(" (2+2) != 4 : " + notequal + "<br/>");
document.write("--------------------------------------------------------------------------------------------------------------<br/>");
//逻辑运算符
var intersection = true && (1 > 2);
document.write(" true && (1 > 2) : " + intersection + "<br/>");
var union = true || (1 > 2);
document.write(" true || (1 > 2) : " + union + "<br/>");
var not = !(1 > 2);
document.write(" !(1 > 2) : " + not + "<br/>");
document.write("--------------------------------------------------------------------------------------------------------------<br/>");
//条件运算符
var condition = (3 > 5) ? "你" : "我";
document.write('(3 > 5) ? "你" : "我" ' + condition + "<br/>");
document.write("--------------------------------------------------------------------------------------------------------------<br/>");
//字符串转数字
var c = Number("1002") + 1000;
document.write(c + "<br/>");
document.write("Number('123'): " + Number("123") + "<br/>");
document.write("parseInt('123'): " + parseInt("123") + "<br/>");
document.write("parseFloat('123'): " + parseFloat("123") + "<br/>");
document.write("--------------------------------------------------------------------------------------------------------------<br/>");
//数字转字符串
var a = 2002 + "";
var b = a + 1000;
document.write(b + "<br/>");
var a = 2002;
var b = a.toString() + 1000;
document.write(b + "<br/>");
document.write("--------------------------------------------------------------------------------------------------------------<br/>");
//转义字符
document.write("绿叶,给你\"初恋\"般的感觉~" + "<br/>");
console