
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
766 Views
To transform object of objects to object of array of objects, use the concept of Object.fromEntries() along with map().Exampleconst studentDetails = { 'details1': {Name: "John", CountryName: "US"}, 'details2': {Name: "David", CountryName: "AUS"}, 'details3': {Name: "Bob", CountryName: "UK"}, }; console.log( Object.fromEntries(Object.entries(studentDetails).map(([key, value]) => [key, [value]])) );To ... Read More

AmitDiwan
2K+ Views
This may happen if you haven’t used “export” statement. Use “export” before the function which will be imported into the script file. The JavaScript file is as follows which has the file name demo.js.demo.jsconsole.log("function will import"); export function test(){ console.log("Imported!!!"); }Here is the “index.html” file that imports the above ... Read More

AmitDiwan
2K+ Views
To refresh page, use the location.reload() in JavaScript. The sample JavaScript code is as follows −Example Live Demo Document UserName: Password: Refresh Page $('#RefreshPage').click(function() { location.reload(); ... Read More

AmitDiwan
429 Views
Let’s say the following is our input text −StudentName:To lose input hints on pressing mouse cursor, use onFocus and onBlur concept.Example Live Demo Document StudentName: function guessFocus() { if (this.value == this.defaultValue) ... Read More

AmitDiwan
438 Views
You can use classList.add() along with append(). Use the document.createElement() to create a new div and the classList.add() would add the CSS class.(.class selector).Example Live Demo Document .add-all-subject { display: grid; height: 100px; width: 100px; ... Read More

AmitDiwan
3K+ Views
At first, you need to split() the string on the basis of space and extract the first character using charAt(). Use toUpperCase() for the extracted character.Examplefunction capitalizeTheFirstLetterOfEachWord(words) { var separateWord = words.toLowerCase().split(' '); for (var i = 0; i < separateWord.length; i++) { separateWord[i] = ... Read More

AmitDiwan
192 Views
Let’s say the following is our array with similar values −const listOfStudentName = ['John', 'Mike', 'John', 'Bob', 'Mike', 'Sam', 'Bob', 'John'];To remove similar values from array, use the concept of set(). Following is the code −Exampleconst listOfStudentName = ['John', 'Mike', 'John', 'Bob', 'Mike', 'Sam', 'Bob', 'John']; console.log("The value="+listOfStudentName); const doesNotContainSameElementTwice ... Read More

AmitDiwan
21K+ Views
Use the condition with “” and NULL to check if value is empty. Throw a message whenever ua ser does not fill the text box value.Example Live Demo Document USERNAME: function checkingUserName() { ... Read More

AmitDiwan
285 Views
Yes, you can use Object.fromEntries() along with substr(). Under substr(), mention the index from where to begin the substring and the length.Exampleconst originalString = { "John 21 2010" :1010, "John 24 2012" :1011, "John 22 2014" :1012, "John 22 2016" :1013, } const result = Object.fromEntries(Object.entries(originalString). ... Read More

AmitDiwan
5K+ Views
Get data from tag using find() and store that data into array using push(). Let’s say the following is our table − Name Age John23 David26 Let’s fetch the data from and store in an array. Following is the complete code −Example Live Demo ... Read More