Avoid magic number when referencing an array

Discussions about Java virtual machine, installation, and running

Moderator: Moderators

Avoid magic number when referencing an array

Postby jakobea.donis3324@gmail.com » Thu May 20, 2021 4:43 am

I can't find a straightforward answer to this. How do I refer to parts of an element without using magic numbers?

In this case I am trying to place values of several cells from a row from an HTML table into variables:

Code: Select all
const age = personRow.cells[1].innerText;
const sex = personRow.cells[2].innerText;
Forum Newbie
Forum Newbie
Posts: 1
Posts Rating:0
Joined: Thu May 20, 2021 4:42 am

Return to Installing and running

Who is online

Users browsing this forum: No registered users and 0 guests