skip to Main Content

How to print an JSON string in javascript?

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":"[email protected]","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,…

VIEW QUESTION
Back To Top
Search