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

前端 未结 9 777
感情败类
感情败类 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:26

    python's pass is required for empty blocks.

    try:
        # something
    except Exception:
        pass
    

    In javascript you can simply catch an empty block

    try {
        // some code
    } catch (e) {
        // This here can be empty
    }
    

提交回复
热议问题