Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Here is the Python code that I am trying to solve this problem in JavaScript:
try: float(s) if '.' in s else int(s) return True except ValueError: return False
I'm looking for the keyword equivalent to "except" in Python.
try
In javascript, we have try, catch and finally.
catch
finally
try { //may throw } catch(ex) { //handle the error, where ex or what ever you choose to call it is your exception reference } finally { //perform this code regardless }
Add a comment
trystatement? It would have told you exactly what you needed to know.