function
setup() {
createCanvas(550, 300);
textSize(16);
let stringDict =
createStringDict(
"Statue of Unity"
,
"182 m"
);
text(
"New string dictionary created "
+
"with one key"
, 20, 20);
let existOne =
stringDict.hasKey(
"Statue of Unity"
);
text(
"Dictionary has key "
+
"'Statue of Unity': "
+
existOne, 20, 60);
let existTwo =
stringDict.hasKey(
"Spring Temple Buddha"
);
text(
"Dictionary has key "
+
"'Spring Temple Buddha': "
+
existTwo, 20, 100);
let tmpObj = {
"Spring Temple Buddha"
:
"128 m"
,
"Ushiku Daibutsu"
:
"100 m"
,
"Great Buddha of Thailand"
:
"92m"
};
stringDict.create(tmpObj);
text(
"New keys added with create()"
,
20, 140);
existTwo =
stringDict.hasKey(
"Spring Temple Buddha"
);
text(
"Dictionary has key "
+
"'Spring Temple Buddha': "
+
existTwo, 20, 180);
let existThree =
stringDict.hasKey(
"Ushiku Daibutsu"
);
text(
"Dictionary has key "
+
"'Ushiku Daibutsu': "
+
existThree, 20, 220);
}