Skip to content

TypeScript code snippet – How to check if var exists python?

#if the variable is local: 
if 'myVar' in locals():
  # myVar exists

#if the variable is global:
if 'myVar' in globals():
  # myVar exists.
See also  TypeScript code snippet - How to make an element be above all the other elements html?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.