score:1

in your current for implementation, if extracting fails in the middle of the operation, you are not going to get all places, you will get some of them. instead

let places
try{
    // check if placeid is a string or number. i think should be string
    const placeid = await prenotationcontract.methods.placeid().call()

    places = await promise.all(
         // since your for loop is till placeid
         array(parseint(placeid))
             .fill()
             .map((element, index) => {
                // since places is public, solidity assgins a getter automatically
                return prenotationcontract.methods.places(index).call();
              })
           );
} catch (e) {
       console.log("error in extracting places", e);
    }

Related Query

More Query from same tag