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
272 Views
For this, use map() along with find(). Following is the code −Examplevar details1 = [ { productDetails: { isSold: true, productId:101 } }, { productDetails: ... Read More
AmitDiwan
318 Views
To declare and define multiple variables in one statement, you can use below syntax −var anyVariableName1=yourValue1, anyVariableName2=yourValue2, anyVariableName3=yourValue3, anyVariableName4=yourValue4, . . NExamplevar firstName="My First Name is David", lastName="My Last Name is Miller", place="I live in AUS"; console.log(firstName); console.log(lastName); console.log(place);To run the above program, you need to use the following command ... Read More
AmitDiwan
348 Views
To check whether a checkbox is checked in jQuery, use the concept of toggle(). Following is the code −Example Live Demo Document Your name is Adam Smith $('#selectName').click(function() { $("#txtName").toggle(this.checked); }); To ... Read More
AmitDiwan
691 Views
Let’s say the following is our dropdown − John David Chris Mike Bob Carol Following is our array −var listOfNames = ["Chris", "Robert", "Mike"];To check whether the selected list value contains a value in array, use −$(‘select’).on(‘change’).Example Live Demo Document ... Read More
AmitDiwan
252 Views
Let’s say the following is our list −var details=[ {id:101, name:"John", age:21}, {id:111, name:"David", age:24}, {id:1, name:"Mike", age:22}, {id:"", name:"Sam", age:20}, {id: 1, name:"Carol", age:23}, {id:null, name:"Robert", age:25}, {id:1, name:"Adam", age:24}, {id:"", name:"Chris", age:23} ];You can use the concept of filter to ... Read More
AmitDiwan
610 Views
Let’s say the following are our coordinates −var listOfStrings = ["10.45322, -6.8766363", "78.93664664, -9.74646646", "7888.7664664, -10.64664632"];To convert the above into two float lists of Latitude and Longitude, use split() on the basis of comma(, ) along with map().Examplevar listOfStrings = ["10.45322, -6.8766363", "78.93664664, -9.74646646", "7888.7664664, -10.64664632"]; var latitude = []; ... Read More
AmitDiwan
394 Views
To ignore a specific value, use the logical Not (!) operator in if condition and fetch watching you want to include.Examplevar customerDetails=[ { customerName:"John", customerAge:28, customerCountryName:"US" }, { customerName:"David", customerAge:25, ... Read More
AmitDiwan
559 Views
To select random values from an array, use the concept of Math.random().Examplevar subjectNames = ["Javascript", "MySQL", "Java", "MongoDB", "Python", "Spring Framework"]; for(var index = subjectNames.length - 1; index > 0; index--){ var rndIndex = Math.floor(Math.random() * (index + 1)); var subjNameTemp = subjectNames[rndIndex]; subjectNames[rndIndex] = subjectNames[index]; ... Read More
AmitDiwan
13K+ Views
Let’s say the following is our array of objects −var details = [{ studentName: "John", studentMarks: 92 }, { studentName: "David", studentMarks: 89 }, { studentName: "Mike", studentMarks: 98 }, ];To get only specific values in an array of objects in JavaScript, use the ... Read More
AmitDiwan
440 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