I am looking for a JavaScript equivalent of the Python:
pass
statement that does not run the function of the ...
notation?
Is there such a thing in JavaScript?
With Python >= 3.0, you should use ... (Ellipsis) instead of pass to indicate "finish later" blocks.
Python pass Statement The pass statement is used as a placeholder for future code. When the pass statement is executed, nothing happens, but you avoid getting an error when empty code is not allowed. Empty code is not allowed in loops, function definitions, class definitions, or in if statements.
In python, we can write an empty function or statements by using the 'pass” statement. Writing a pass statement does nothing and is simply used to avoid compile errors while writing an empty function. Above code statements are little different than other popular programming languages like C,C++ or Java.
What is pass statement in Python? In Python programming, the pass statement is a null statement. The difference between a comment and a pass statement in Python is that while the interpreter ignores a comment entirely, pass is not ignored. However, nothing happens when the pass is executed.
Python's pass
mainly exists because in Python whitespace matters within a block. In Javascript, the equivalent would be putting nothing within the block, i.e. {}
.
use //pass
like python's pass
like:
if(condition){
//pass
}
This is equivalent to leaving the block with nothing in it, but is good for readability reasons.
reference from https://eslint.org/docs/rules/no-empty
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With