File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
programming/javascript/user-guide Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,10 @@ If you are fully satisfied with the solution and would like to move forward with
8080 (async () => {
8181 // Launch the scanner and wait for the result
8282 const result = await barcodeScanner .launch ();
83- alert (result .barcodeResults [0 ].text );
83+ // Display the first detected barcode's text in an alert
84+ if (result .barcodeResults .length ) {
85+ alert (result .barcodeResults [0 ].text );
86+ }
8487 })();
8588 </script >
8689 </body >
@@ -210,7 +213,10 @@ const barcodescanner = new Dynamsoft.BarcodeScanner({
210213(async () => {
211214 // Launch the scanner and wait for the result
212215 const result = await barcodescanner .launch ();
213- alert (result .barcodeResults [0 ].text );
216+ // Display the first detected barcode's text in an alert
217+ if (result .barcodeResults .length ) {
218+ alert (result .barcodeResults [0 ].text );
219+ }
214220})();
215221```
216222
You can’t perform that action at this time.
0 commit comments