Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8242077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:03:01+00:00 2026-06-07T21:03:01+00:00

<!DOCTYPE html> <html> <body> <h2>JSON Object Creation in JavaScript</h2> <p> Name: <span id=jname></span><br />

  • 0
<!DOCTYPE html>
<html>
<body>
<h2>JSON Object Creation in JavaScript</h2> 

<p>
Name: <span id="jname"></span><br />
Eval Name: <span id="evalname"></span><br />
<p>
<script>
var yyyy= {
"name":"John Johnson",
"street":"Oslo West 555",
"age":33,
"phone":"555 1234567"};


document.getElementById("jname").innerHTML = yyyy.name;
document.getElementById("evalname").innerHTML = eval(yyyy).name;
</script>

</body>
</html>

i am getting out put as below this is same with and without eval()

JSON Object Creation in JavaScript

Name: John Johnson

Eval Name: John Johnson

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:03:03+00:00Added an answer on June 7, 2026 at 9:03 pm

    yyyy isn’t JSON. It’s a JavaScript object. So in this case, you don’t need eval whatsoever. When you deal with JSON, you should use JSON.parse instead of eval.

    eval simply returns the object you passed to it, without modifying it. So it’s superfluous here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<!DOCTYPE html> <html> <head> <title></title> </head> <body> <script> var str = { 'foo': 'bar'
<!DOCTYPE html> <html> <script type=text/javascript src=../jquery-1.4.4.min.js /> <script type=text/javascript> function click(){ var select =
See example: <!DOCTYPE html> <html> <head> <title>language</title> <script type=text/javascript src=http://www.google.com/jsapi> </script> </head> <body> <div
i am trying to understand following fragment of javascript code <!DOCTYPE html> <html> <body>
<!DOCTYPE HTML> <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.2.js></script> <script type=text/javascript> $(#myBtn).on(click,function(){ alert('myBtn Clicked'); }); </script>
HTML <!doctype html> <html> <head> </head> <body> <button id=b1 type=button>Show Spoiler</button> <p id=p1 style=display:none>
<!DOCTYPE HTML> <html> <body> <video width=320 height=240 controls=controls> <source src=tutorial.mp4 type=video/mp4 /> Your browser
I have the following html and css code: <!DOCTYPE HTML> <html> <head> </head> <body>
Here is my code: <!DOCTYPE html> <html> <head> <meta charset=utf-8> <meta name=viewport content=width=device-width, initial-scale=1>
How do I parse an HTML response in Objective-C, to find a JSON object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.