Is there a JavaScript equivalent of the Python pass statement that does nothing?

前端 未结 9 657
感情败类
感情败类 2021-02-06 20:02

I am looking for a JavaScript equivalent of the Python:

pass statement that does not run the function of the ... notation?

Is the

9条回答
  •  北海茫月
    2021-02-06 20:29

    Javascript does not have a python pass equivalent, unfortunately.

    For example, it is not possible in javascript to do something like this:

    process.env.DEV ? console.log('Connected..') : pass

    Instead, we must do this:

    if (process.env.DEV) console.log('Connected..')

    The advantage of using the pass statement, among others, is that in the course of the development process we can evolve from the above ternary operator example in this case without having to turn it into a full if statement.

提交回复
热议问题