3
I have a JS (data.js) file that contains an array of the information below:
module.exports = [
{
"photo": "https://a0.muscache.com/im/pictures/e6c4b347-49c7-4840-8c00-df36a2a273da.jpg?aki_policy=x_large",
"property_type": "Apartamento",
"name": "Apartment in Son Parc, wonderful views",
"price": 433
},
{
"photo": "https://a0.muscache.com/im/pictures/4a5326cb-95e4-4220-a4d8-c91f50cf784c.jpg?aki_policy=xx_large",
"property_type": "Apartamento",
"name": "APARTAMENTO IDEAL PAREJAS EN SON PARC",
"price": 368
},
]
and I need to use this information in HTML. How do I make Javascript recognize this file? I am trying this command, but it gives error.
const dados = require('./dados.js');
console.log(dados);
I’m doing the console.log to test if I brought the information, then I continue the work.
But you are trying to import this data into another javascript or html file?
– Isac
I am placing the import in Java.
– Rodrigo Emanuel