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
243 Views
Let’s say, we have subject records with the time when we are planning to study them −const scheduleDetails = [ { subjectName: 'JavaScript', studyTime: '5 PM - 11 PM' }, { subjectName: 'MySQL', studyTime: '12 AM - 4PM' } ]Here is how we can use the map(). Following ... Read More
AmitDiwan
1K+ Views
To format HSON string in JavaScript, use JSON.stringify() with some parameters. Following is the code −Examplevar details = { studentId: 101, studentFirstName: 'David', studentLastName: 'Miller', studentAge:21, subjectDetails: { subjectId: 'JavaScript_101', subjectName: 'Introduction to JavaScript', } }; console.log("Not Pretty ... Read More
AmitDiwan
2K+ Views
To check for consecutive numbers like 100, 101, 102, etc., use the concept of reduce(). TRUE would be returned for consecutive numbers, else false is the return value.Exampleconst sequceIsConsecutive = (obj) => Boolean(obj.reduce((output, lastest) => (output ? (Number(output.number) + 1=== Number(lastest.number) ? lastest : false) : false))); console.log("Is Consecutive="+sequceIsConsecutive ([{ ... Read More
AmitDiwan
199 Views
Following is our object −var customerDetails ={ "customerFirstName":"David", "customerLastName":"Miller", "customerAge":21, "customerCountryName":"US" };Now, create a new array and use push() function. Following is the code −Examplevar customerDetails ={ "customerFirstName":"David", "customerLastName":"Miller", "customerAge":21, "customerCountryName":"US" }; var customerObjectToArray = []; customerObjectToArray.push(customerDetails); console.log(customerObjectToArray);To run the above program, ... Read More
AmitDiwan
5K+ Views
Let’s say the following is our input type with value, “John Smith” −To change, use the attr() method −$('#changeTheName').attr('value', 'Please enter your name.......');You need to use the concept of attr(). Following is the code −Example Live Demo Document $('#changeTheName').attr('value', ... Read More
AmitDiwan
468 Views
Let’s say the following is our file name −var actualJavaScriptFileName = "demo.js";Following is the word to be inserted before the dot extension −var addValueBetweenFileNameAndExtensions = "programming";At first, you need to split() the file name on the basis of dot(.) and then to insert a character, you can use the concept ... Read More
AmitDiwan
426 Views
To convert string type value to array type, use the parse() method. Following is the code −Examplevar customerDetails='[ {"name": "John", "countryName": "US"}, {"name": "David", "countryName": "AUS"}, {"name": "Bob", "countryName": "UK"} ]'; console.log("The actual value="+customerDetails); var convertStringToArray=JSON.parse(customerDetails); console.log("After converting string to array objects="); console.log(convertStringToArray);To run the above program, ... Read More
AmitDiwan
1K+ Views
At first, set the element −Replace This strong tagThe id attribute set above would be used set the text using # −$(document).ready(function(){ $("#strongDemo").html("Actual value of 5+10 is 15....."); });Example Live Demo Document Replace This strong tag $(document).ready(function(){ ... Read More
AmitDiwan
561 Views
To set an element and it’s text, use the text() method in jQuery. With that, use the :nth-child selector to place it at a particular position. Following is the code −Example Live Demo Document JavaScript MySQL MongoDB Java C# $('h1:nth-child(4)').text("Python"); ... Read More
AmitDiwan
3K+ Views
To group JSON data, you need to extract all the keys and use the push(). Following is the code −Examplevar details= { "1": { name:"John" }, "2": { name:"John" }, "3": { name:"David" ... Read More