Skip to content

Commit 2becdb6

Browse files
[ai-form-recognizer] Remove optional chaining operators from JS samples (Azure#12496)
1 parent ff9d8cd commit 2becdb6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sdk/formrecognizer/ai-form-recognizer/samples/javascript/recognizeBusinessCard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ async function main() {
4747
console.log("Contact Names:");
4848
for (const contactName of contactNames) {
4949
if (contactName.valueType === "object") {
50-
const firstName = contactName.value?.["FirstName"].value || "<no first name>";
51-
const lastName = contactName.value?.["LastName"].value || "<no last name>";
50+
const firstName = contactName.value["FirstName"].value || "<no first name>";
51+
const lastName = contactName.value["LastName"].value || "<no last name>";
5252
console.log(`- ${firstName} ${lastName} (${contactName.confidence} confidence)`);
5353
}
5454
}
@@ -73,7 +73,7 @@ async function main() {
7373
* processing.
7474
*/
7575
function printSimpleArrayField(businessCard, fieldName) {
76-
const fieldValues = businessCard.fields[fieldName]?.value;
76+
const fieldValues = businessCard.fields[fieldName].value;
7777
if (Array.isArray(fieldValues)) {
7878
console.log(`${fieldName}:`);
7979
for (const item of fieldValues) {

0 commit comments

Comments
 (0)