console
function hanshu(firstname,lastname){
// var k = fanhui();
// document.getElementById('kk').innerHTML = k;
document.getElementById('kk').innerHTML = fanhui();
}
// function fanhui(){
// var x = '龙敏';
// return x;
// }
function myfunction(){
// 数组
/*var x = new Array();
x[0] = 1;
x[1] = 2;
x[2] = 3;
x[3] = 4;
alert(x.length);*/
/*var y = new Array('a','b','c','d');
alert(y + ';' + y.length);*/
/*var z = ['q','w','e'];
alert(z + ";" + z.length);*/
// 对象
/*var person = {"firstname":"long","lastname":"min","id":"15796"};
document.getElementById("ff").innerHTML = person.firstname + "," + person.lastname + "," +person.id;
document.getElementById('dd').innerHTML= person['firstname'] + "," +person['lastname'] + "," + person['id'];*/
// null 清空变量
/*var cart = '1200';
alert(cart);
var cart = null;
alert(cart);*/
// new 声明变量类型
/*var x = new String;
var y = new Number;
var z = new Boolean;
var t = new Array;
var b = new Object;*/
// 对象
// var txt = 'Visit W3School!';
// alert(txt.length);
// alert(txt.indexOf('o')); //字符首次出现位置
// alert(txt.search(/sit/));
// document.write(txt.replace(/Hello/,'world')); //替换
// document.write(txt.toUpperCase()); //字符串转换为大写
}
<button onclick="myfunction()">点击这里</button>
<span id="ff"></span>
<span id="dd"></span>
<button onclick="hanshu('long','min')">函数</button>
<button onclick="fanhui()">返回值</button>
<p id="kk"></p>
#ff,#dd,h1,h2,h3,h4,h5,h6,#kk{color:#fff;}