Properties
Category
English
Similar Topics
Statistics
Comments
5
Participants
4
Subscribers
29
Votes
2
Views
887
Share
Answered
I want to delete an object if it exists using IsDefined() but even using this command I get an error saying: undefined variable a ..
I'm trying this If(IsDefined(a), Delete(a)) hope someone help me please
Thanks in advance
- GeoGebra
- Help
- Partners
-
Contact us
- Feedback & Questions
- This email address is being protected from spambots. You need JavaScript enabled to view it.
- +43 677 6137 2693
© 2023 International GeoGebra Institute
Write without any condition:
Delete(a)
nothing is happen when "a" not exist. After Delete(a) you can be sure that "a" not exist.
-----------------------------------------------------------------------------------------------
Note1: IsDefined() is
- false when the object exist and the value is undefined
- true when the object exist and the value is not undefined
- go to an error if object not exist (see also exception Note2)
only in JavaScript (not in ggb-scripts) you can ask "exists(String objName)"
.
Note2: When a table-cell is empty (not exist)
after IsDefined(<empty-cell>) no error is happen but now the cell is not empty (the object exists) and the value of the cell is undefined, so the answer is false.
Comments have been locked on this page!