Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7542054
test_optional_chain.cjs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
516 B
Referenced Files
None
Subscribers
None
test_optional_chain.cjs
View Options
// Simple test for optional chaining
Ant.println("Test 1: Basic optional chaining");
const value = undefined;
const result = value?.thing;
Ant.println("value?.thing:", result);
Ant.println("\nTest 2: With object");
const obj = { nested: { deep: "value" } };
const result2 = obj?.nested?.deep;
Ant.println("obj?.nested?.deep:", result2);
Ant.println("\nTest 3: In if statement");
if (value?.thing) {
Ant.println("FAIL");
} else {
Ant.println("PASS: value?.thing is falsy");
}
Ant.println("\nAll tests done");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jun 17, 2:38 PM (14 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
569865
Default Alt Text
test_optional_chain.cjs (516 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment