
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
382 Views
This is the concept of Bubble Sort. It compares to adjacent element if it is lesser it will swap the value.ExampleFollowing is the code −var numbers = [10, 100, 30, 40, 90, 4, 91, 56, 78]; function bubbleSorting(numbers) { for (var outer = 0; outer < numbers.length; outer++) { ... Read More

AmitDiwan
112 Views
For this, use tag. Set it to contenteditable −We have set the following style for paste − pre { min-height: 150px; min-width: 300px; font-family: 'Times New Roman', Times, serif; white-space: pre; background-color: rgb(19, ... Read More

AmitDiwan
8K+ Views
To get value of data attribute, use −$(“yourSelector”).data()The following is our input type with data attribute −ExampleFollowing is the code − Live Demo Document var value = $('#txtValue').data('value'); console.log("The value is=" + value); OutputThe output is as follows −

AmitDiwan
168 Views
Create a custom function to test a number is prime or not in JavaScript.ExampleFollowing is the code −function checkNumberIsPrime(number) { var flag = false; for (start = 2; start < number / 2; start++) { if (number % start === 0) { ... Read More

AmitDiwan
152 Views
The Math.ceil() is part of the Math object in JavaScript. Suppose, your value is 4.5 or 4.3, it will give the result 5.Let’s say the following are our values −var result1 = 98; var result2 = 5;Following is the code to display the result difference while using ceil() or not ... Read More

AmitDiwan
269 Views
Let’s say the following are our records with some duplicate values −var objectOfNationality = [ { nationality: "Indian" }, { nationality: "American" }, { nationality: "Emirati" }, { nationality: "Indian" }, { nationality: "American" ... Read More

AmitDiwan
4K+ Views
Let’s say the following is our string in dot notation −const keys = "details1.details2.details3.details4.details5"And the following is our array −const firsName = "David";To turn into a nested object, use the concept of split(‘.’) along with map().ExampleFollowing is the code −const keys = "details1.details2.details3.details4.details5" const firsName = "David"; var tempObject = ... Read More

AmitDiwan
235 Views
Let’s say we are getting two values with prompt −var firstvalue = parseInt(prompt("Enter the value1")); var secondvalue = parseInt(prompt("Enter the value2"));ExampleFollowing is the code − Live Demo Document var firstvalue = parseInt(prompt("Enter the value1")); var ... Read More

AmitDiwan
133 Views
You cannot change the value of an object when it is defined using const keyword.After changing it will remain same.Let’s say the following is our variable defined with const −const details1 = { firstName: 'David', subjectDetails: { subjectName: 'JavaScript' } }ExampleFollowing is the code to change the const ... Read More

AmitDiwan
178 Views
Let’s say the following are our objects −var object1 = { firstName: "David" }; var object2 = { firstName: "David" };You will not get the correct result using comparison operator (== or ===). Use JSON.stringify() for this.ExampleFollowing is the code implementing both the ways and showing the correct result −var ... Read More