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 10740 Articles
AmitDiwan
1K+ Views
Let’s say the following is our variable −var message = 'This is the Class Demo';Following is our object, var object = new FirstClass(message)The class FirstClass −class FirstClass{ constructor( message){ this.message = message; } }We will use eval() to call a JavaScript class object with variable. ... Read More
AmitDiwan
193 Views
Let’s say the following is our object −var details ={ firstName: "John", lastName: "Smith", age:21, subjectName:"JavaScript", marks:89, coutryName:"US", collegeName:"MIT", passoutYear:2018 };Following is the code to fetch only a subset −Examplevar details ={ firstName: "John", lastName: "Smith", age:21, subjectName:"JavaScript", ... Read More
AmitDiwan
3K+ Views
Let’s say the following is our comma separated text in div − This, is, the, first, JavaScript, program To convert comma separated text into separate lines, you need to use trim() along with split() on the basis of comma(, ).Example Live Demo Document ... Read More
AmitDiwan
5K+ Views
Let’s say the following is our nested objects −var details = [ { id:"101", firstName:"John", lastName:"Smith", age:25, countryName:"US", subjectDetails: { subjectId:"Java-101", subjectName:"Introduction to ... Read More
AmitDiwan
863 Views
Let’s say the following is our object −var details = { firstName: 'John', lastName: '', countryName: 'US' }Use Object.keys() along with find() to get the key name with empty value. Following is the code −Examplevar details = { firstName: 'John', lastName: '', countryName: 'US' ... Read More
AmitDiwan
5K+ Views
Let’s say the following is our object −var apiJSONObject = [ {subjectName:"MySQL"}, {subjectName:"Java"}, {subjectName:"JavaScript"}, {subjectName:"MongoDB"} ]Let’s check for existence of a value “JavaScript” −Examplevar apiJSONObject = [ {subjectName:"MySQL"}, {subjectName:"Java"}, {subjectName:"JavaScript"}, {subjectName:"MongoDB"} ] for(var i=0;i node demo117.js The search found in JSON ObjectRead More
AmitDiwan
3K+ Views
Let’s see an example wherein we are validating input text onsubmit −Example Live Demo Document function validateTheForm(){ var validation = (document.getElementById('txtInput').value == 'gmail'); if(!validation){ alert('Something ... Read More
AmitDiwan
2K+ Views
For this, use forEach() loop along with push(). Following is the code −Examplevar studentDetails= [ { studentId:1, studentName:"John" }, { studentId:1, studentName:"David" }, { studentId:2, studentName:"Bob" ... Read More
AmitDiwan
1K+ Views
You can create an associative array in JavaScript using an array of objects with key and value pair.Associative arrays are basically objects in JavaScript where indexes are replaced by user defined keys.Examplevar customerDetails= [ { "customerId":"customer-1", "customerName":"David", "customerCountryName":"US" }, ... Read More
AmitDiwan
806 Views
Let’s say the following is our array −var listOfNames = [ 'John', 'David', 'Bob' ];Following is our button −Click The Button To get the Reverse ValueNow, for array items in reverse, at first, reach the array length and decrement the length by 1. Then, print the contents ... Read More