Home >Web Front-end >JS Tutorial >What is lazy evaluation in javascript

What is lazy evaluation in javascript

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-07-19 14:29:212027browse

If in a continuous logical operation, the operation result is already clear before the last operation is completed, then the operation often does not need to continue to be executed, because it will not have any impact on the final result. Influence.

What is lazy evaluation in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

Definition

If in a continuous logical operation, the operation result is already clear before the last operation is completed, then the operation often does not need to continue to be executed, because it has already been There will be no impact on the final result.

Example

true || “cat” Result: true

true && “cat” Result: cat

true && “cat” || true Result: true

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of What is lazy evaluation in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn