本文介绍了javascript通行证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想要这样做的javascript等价物:

  try:
#引发异常的东西
catch:
pass


解决方案

您需要它为空块,因为

  try:
#引发异常的东西
catch:

#继续其他的东西

。在JavaScript中,您只需使用一个空的 catch 块。

  try { 
//引发异常的东西
}
catch(e){}


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
解决方案

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) {}

这篇关于javascript通行证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 08:14
查看更多