我在学习WXS的一元运算符时,复制文档中的示例代码,打印的结果有点不太理解,希望有朋友能解疑一下。


文档地址


* 问题:

运行结果,只打印了一条日志出来 。按我的理解应该每行都会有打印日志的呀。


* 提供一个最简复现 Demo


// pages/index/utils.wxs

var a = 10, b = 20;


// 自增运算

console.log(10 === a++);

console.log(12 === ++a);

// 自减运算

console.log(12 === a--);

console.log(10 === --a);

// 正值运算

console.log(10 === +a);

// 负值运算

console.log(0 - 10 === -a);

// 否运算

console.log(-11 === ~a);

// 取反运算

console.log(false === !a);

// delete 运算

console.log(true === delete a.fake);

// void 运算

console.log(undefined === void a);

// typeof 运算

// console.log("number" === typeof a);++a);



// pages/index/jywxs.wxml

<wxs src="./utils.wxs" module="jyutil"/>



展开全部
收起
1回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • 理屈词穷

    13人对此回答表示赞同

    沉没了。。。

    展开
    13
    0回复
    发布于 5年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部