
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
414 Views
For this, you can use filter() along with map().Exampleconst details =[ { customerName: 'John', customerCountryName: 'UK', isMarried :true }, { customerName: 'David', customerCountryName: 'AUS', isMarried :false }, { customerName: 'Mike', customerCountryName: 'US', isMarried :false } ] let tempObject = details.filter(obj=> obj.isMarried == true); tempObject["customerNameWithIsMarriedFalse"] = details.filter(obj => ... Read More

AmitDiwan
1K+ Views
For this, use click() along with parseInt().Example Live Demo Document 10 addValue10EachTimePressMe addValue = 0; $("#addSequenceOf10").click(function() { var actualValue = parseInt($("#add").html()); addValue =addValue+ actualValue; $("#sequenceValue").html(addValue); }); ... Read More

AmitDiwan
59 Views
For iterating and printing, use forEach() loop in JavaScript.Exampleconst details =[ { "studentId":101, "studentName": "John Doe", }, { "studentId":102, "studentName": "David Miller", }, ]; details.forEach(obj=>{ console.log("StudentId="+obj.studentId); console.log("StudentName="+obj.studentName); })To run the above program, ... Read More

AmitDiwan
100 Views
You can use destructed array in this case.Examplefunction multiply(firstParameterDefaultValue=10, secondParameterValue) { return firstParameterDefaultValue * secondParameterValue; } console.log("The result="+multiply(...[, 10]));To run the above program, you need to use the following command −node fileName.js.Here, my file name is demo173.js.OutputThis will produce the following output −PS C:\Users\Amit\javascript-code> node demo173.js The result=100Read More

AmitDiwan
185 Views
If you won’t pass value to a function(), it will print the default value otherwise given parameter will be printed.Following is the code. We are setting a default here i.e. “Jack” in this case to avoid any undefined error when a function is called without any parameter −Examplefunction display({ name ... Read More

AmitDiwan
2K+ Views
Yes, we can use a new line using “” in console.log(). Following is the code −Exampleconst studentDetailsObject = new Object() studentDetailsObject.name = 'David' studentDetailsObject.subjectName = 'JavaScript' studentDetailsObject.countryName = 'US' studentDetailsObject.print = function(){ console.log('hello David'); } console.log("studentObject", "", studentDetailsObject);To run the above program, you need to use the following command ... Read More

AmitDiwan
10K+ Views
For this, use JSON.parse() along with JSON.stringify().Example Live Demo Document Click The Button To get the Pretty JSON function printTheJSONInPrettyFormat() { var badJSON = document.getElementById('prettyJSONFormat').value; var parseJSON = JSON.parse(badJSON); ... Read More

AmitDiwan
576 Views
Let’s say the following is our radio button group − Gender: Male Female To check a radio in radio group, you need to set checked property to true in JavaScript. Following is the code −Example Live Demo Document ... Read More

AmitDiwan
408 Views
For this, you can use the concept of modular operator along with divide. Following is the code −Examplevar divideInteger = function(value, divide) { var num; var modular = value % divide; if(modular == 0){ num = value/divide; sumOfDivideParts = Array(divide).fill(num); ... Read More

AmitDiwan
89 Views
Let’s say the following is our object −var lastName ={ "John":"Smith", "David":"Miller", "Bob":"Taylor" }Following is our array −var firstName=[ "Bob", "John", "David" ]Display resultant array based on the object’s order determined by the first array, use map(). Following is the code −Examplevar firstName=[ ... Read More