Why doesn’t this produce anything?
console.log(JSON.stringify(function(){console.log('foobar');}));
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
JSON can’t stringify functions at all, it handles them just like
undefinedornullvalues. You can check the exact algorithm at EcmaScript 5.1 §15.12.3, see also the description at MDN.However you of course can stringify function expression by casting them to a string, try