How to print an JSON string in javascript?
Advertisements When I try to print console.log(body.email), the console says its undefined, but when I call console.log(body) it returns me {"email":"exampleemail@gmail.com","password":"Password"} here is the code below: document.getElementById("SingupForm").addEventListener(‘submit’, evt =>{ evt.preventDefault() const form = evt.target const body =JSON.stringify({ email: form.elements.email.value, password: form.elements.password.value, }) console.log(body.email) }) I’ve tried to rename the strings and add them to an… Read More How to print an JSON string in javascript?