JavaScript初学者笔记、类型转换、输出等(一)
- 共 570 次检阅

// 1,声明变量
var age;
//2,赋值
age = 18;
//3,输出结果
console.log(age);

var ages = 188;
console.log(ages);

var myname = 'pink老师';
console.log(myname);

var name = "旗木卡卡西";
var age = 30;
var address = "火影村";
var email = "7856465@qq.com";
var gongzi = 200;
console.log('我叫'+name+',我今年'+age+'我住在'+address+',我的邮箱是'+email+'我的日薪是'+gongzi+'元一天');


//声明一个变量nun赋值位10
var num = 10;
//将该数字类型转换为字符串类型
var str = num.toString();

//控制台输出 转换后的字符串
console.log(str);
//控制台输出 变量str的数据类型
console.log(typeof str);
//利用string(变量)
console.log(String(num));
//利用+拼接字符串方法实现转换效果(隐式转换)
console.log(num + '');


var myname = '老师';
console.log(myname);

var myname = '路人甲';
console.log(myname);

var age = 18;
var address = 'huoyingcun';
var gz = 1800;

var age = 18,
    address = 'hjuoying',
    dondn = 126;

var sex;
console.log(sex);

//console.log(tel);

huo = 16;
console.log(huo);

 

分享到:

这篇文章还没有评论

发表评论