Intra Intra - 2 years ago 264
Javascript Question

javascript pass

Is there something along the lines of python 'pass' in javascript?

I want to do the javascript equivalent of:

try:
# Something that throws exception
catch:
pass

Answer Source

pass is a no-op in Python. You need it for empty blocks because

try:
    # Something that throws exception
catch:

# continue other stuff

is a syntax error. In JavaScript you can just use an empty catch block.

try {
    // Something that throws exception
}
catch (e) {}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download