preserve log啥意思

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了preserve log啥意思相关的知识,希望对你有一定的参考价值。

preserve log
保存日志

例句筛选
1.
When you deploy the project, the refactoring log helps preserve the intent of your changes.
在部署项目时,重构日志有助于保存更改的用途。

2.
When you deploy your changes, the refactoring log file helps preservethe intent of your changes to the database project.
当您部署变更时,重构录档案会帮助您保留原本变更资料库专案的意图。
参考技术A special preserve
特殊保护
She regards negotiating price with customers as her special preserve.
她把与顾客讨价还价看作自己的专长。

“|”是啥意思(单管道)在 JavaScript 中做啥?

【中文标题】“|”是啥意思(单管道)在 JavaScript 中做啥?【英文标题】:What does the "|" (single pipe) do in JavaScript?“|”是什么意思(单管道)在 JavaScript 中做什么? 【发布时间】:2011-09-05 21:37:33 【问题描述】:
console.log(0.5 | 0); // 0
console.log(-1 | 0);  // -1
console.log(1 | 0);   // 1

为什么0.5 | 0 返回零,但任何整数(包括负数)都返回输入整数?单管道(“|”)有什么作用?

【问题讨论】:

它有助于防止语法错误提醒您输入的事实 |而不是 || 通过以这种方式在浮点数上使用按位或,您基本上是在依赖 JavaScript 的不成熟。 Python3 会引发错误TypeError: unsupported operand type(s) for |: 'float' and 'int' 【参考方案1】:

这是Bitwsie OR (|)。

操作数被转换为 32 位整数并由一系列位(零和一)表示。超过 32 位的数字会丢弃其最高有效位。

因此,在我们的例子中,十进制数被转换为整数 0.5 到 0。

= 0.5 | 0
= 0   | 0
= 0

【讨论】:

【参考方案2】:

这是bitwise or。 由于按位运算只对整数有意义,0.5 被截断。

x | 0x,如果 x 是一个整数。

【讨论】:

这是将浮点数转换为int的好方法,或者使用parseInt() @MaBi:但是您应该知道该值已转换为 32 位整数,因此对于较大的数字将无法正常工作。 那么可以认为和Floor函数一样吗? 仅用于位或。正如@Guffa 所说,大量的行为不会像预期的那样。例如:248004937500 | 0 = -1103165668 大数会溢出,因为它们被转换为 32 位 int。【参考方案3】:

这个例子会对你有所帮助。

var testPipe = function(input)  
   console.log('input => ' + input);
   console.log('single pipe | => ' + (input | 'fallback'));
   console.log('double pipe || => ' + (input || 'fallback'));
   console.log('-------------------------');
;

testPipe();
testPipe('something'); 
testPipe(50);
testPipe(0);
testPipe(-1);
testPipe(true);
testPipe(false);

【讨论】:

【参考方案4】:

单个管道是bit-wise OR。

对每一对执行 OR 操作 位。 a OR b 产生 1 如果 a 或 b 为 1。

JavaScript 会在按位运算中截断任何非整数,因此其计算为 0|0,即 0。

【讨论】:

这不能回答问题。 ("为什么返回 0")【参考方案5】:

位比较是如此简单,几乎无法理解;)看看这个“nybble”

   8 4 2 1
   -------
   0 1 1 0 = 6  (4 + 2)
   1 0 1 0 = 10 (8 + 2)
   =======
   1 1 1 0 = 14 (8 + 4 + 2)

按位或运算 6 和 10 将得到 14:

   alert(6 | 10); // should show 14

非常混乱!

【讨论】:

也适用于布尔值。 JS将true解释为1,false为0;所以alert(true | false) //yields 1; alert(true | true) //yields 1; alert(false | true) //yields 1; alert(false | false) //yields 0

以上是关于preserve log啥意思的主要内容,如果未能解决你的问题,请参考以下文章

firefox的network打开preserve log(保留日志)

F12谷歌开发者工具preserve log

如何在 Google Chrome 中关闭 Preserve JavaScript console perseverance

ReDim Preserve 的用途

`git rebase --preserve-merges` 的更快方法

最新谷歌浏览器中的变换样式:preserve-3d 和不透明度