
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
240 Views
To remove ‘0’. ‘undefined’ and empty values, you need to use the concept of splice(). Let’s say the following is our array −var allValues = [10, false, 100, 150 ,'', undefined, 450, null]Following is the complete code using for loop and splice() −Examplevar allValues = [10, false, 100, 150 ,'', ... Read More

AmitDiwan
890 Views
Let’s say the following is our start value −var startValue=10;Let’s say the following is our end value −var endValue=20;Use the for loop to fetch numbers between the start and end value −Examplevar startValue=10; var endValue=20; var total=''; function printAllValues(startValue, endValue){ for(var start=startValue;start < endValue ;start++){ total=total+start+", ... Read More

AmitDiwan
942 Views
At first, declare and initialize the total variable with 0 and then you need to iterate over all the array and extract all the values of array and add up with the updated total variable.Let’s say the following is our array with numbers −var listOfValues = [10, 3, 4, 90, ... Read More

AmitDiwan
1K+ Views
To capitalize only the first letter, use the concept of regular expression along with toUpperCase(). Since the toUpperCase() capitalize the entire string, we need to use Regex to only capitalize the first letter after colon.Let’s say the following is our string −var objectValues='fullName: john Smith';Here’s the complete code to capitalize ... Read More

AmitDiwan
53 Views
To get objects with specific property, use the concept of reduce() on both arrays individually. You don’t need to concatenate. Let’s say the following are our objects with student name and student marksvar sectionAStudentDetails = [ {studentName: 'John', studentMarks: 78}, {studentName: 'David', studentMarks: 65}, {studentName: 'Bob', studentMarks: ... Read More

AmitDiwan
563 Views
Use the concept of map() along with ternary operator (?). Following are our array of objects −let firstCustomerDetails = [ {firstName: 'John', amount: 100}, {firstName: 'David', amount: 50}, {firstName: 'Bob', amount: 80} ]; let secondCustomerDetails = [ {firstName: 'John', amount: 400}, {firstName: 'David', amount: ... Read More

AmitDiwan
921 Views
To create an array from JSON data, use the concept of map() from JavaScript. Let’s say the following is our data −const studentDetails =[ { name : "John" }, { name : "David" }, { name ... Read More

AmitDiwan
198 Views
Yes, JavaScript now supports the “null coalescing” operator, but you can also use the concept of logical OR (||). The syntax is as follows −var anyVariableName=null; var anyVariableName=yourVariableName || yourActualValue;Examplevar fullName=null; console.log("The full name is="+fullName); var actualName=fullName || "David Miller"; console.log("The full name is="+actualName);To run the above program, you need ... Read More

AmitDiwan
921 Views
For this, use a “prototype”. JavaScript objects inherit properties and methods from a prototype. For accessing variables, we have also used the “this” in JavaScript.Examplefunction Customer(fullName){ this.fullName=fullName; } Customer.prototype.setFullName = function(newFullName){ this.fullName=newFullName; } var customer=new Customer("John Smith"); console.log("Using Simple Method = "+ customer.fullName); customer.setFullName("David Miller"); console.log("Using Prototype Method ... Read More

AmitDiwan
4K+ Views
Let’s say the following is our Unordered List (ul) − JavaScript Remove MySQL Remove MongoDB Remove Java Remove Above, you can see the “Remove” button with every li element. On clicking this button, you can remove any li element.Following is ... Read More