WXS 官方文档 中一元运算符打印 的疑问 or Bug
发布于 4 年前 作者 bcheng 9951 次浏览 来自 问答

我在学习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 回复

沉没了。。。

回到顶部