How a Loop Through a JavaScript Object?

How a Loop through a JavaScript object?
Javascript Objects are Variables Containing Variables.
In JavaScript, an object is an entity, with property and type
In JavaScript objects the name:values pair are termed as properties.

var student = {studentName:”Jquery Training”, addrees:”Web”, age:02, type:”blog”};

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>

</head>
<body>
How a Loop through a JavaScript object?

<div id="preview">
</div>

<script>
var students = {
"one": "50 students",
"two": "30 students",
"three":"70 students"
};

for (var key in students) {
if (students.hasOwnProperty(key)) {
$('#preview').append('Class '+key + " : " + students[key]+"<br/>");
}
}
</script>
</body>
</html>

Storing Objects in HTML5 localStorage

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>

</head>
<body>

Storing Objects in HTML5 localStorage

<div id="preview-obj">
</div>

<script>
var testObject = { 'one': 1, 'two': 2, 'three': 3 };

var students = {
"one": "50 students",
"two": "30 students",
"three":"70 students"
};

localStorage.setItem('students', JSON.stringify(students));

var retrievedObject = localStorage.getItem('students');
var obj=JSON.parse(retrievedObject);

for (var key in obj) {
if (obj.hasOwnProperty(key)) {
$('#preview-obj').append('Class '+key + " : " + obj[key]+"<br/>");
}
}

</script>

</body>
</html>

How a Loop Through a JavaScript Object?

How a Loop through a JavaScript object?Javascript Objects are Variables Containing Variables.In Java…

How to Search Item in List in JavaScript

Multi Step Form Using HTML and JavaScript

Form is the important part in web design. Form is the primary interface to the user by which user is…

How to Create Custom CSS, jQuery Autocomplete Plugin

Web developers often use autocomplete features in websites as a part of their work. Yet lot of good …

How to Make Sticky Sidebar Using jQuery and CSS

Sticky sidebar is an essential part of web development. Not in all cases but for some cases where ou…

Selectors, Animation, and AJAX – jQuery Tutorial And Examples

By now I’m sure you have grasped at least the basics and simplicity of the jQuery library. Now it’s …