
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
565 Views
To fetch value from alert pop up, use alert(). At first, use prompt() to input the value from user. Following is the code −Example Live Demo Document var value = prompt("Please enter an integer value"); var multiplyBy10=10*value; alert("Result ... Read More

AmitDiwan
1K+ Views
To detect the screen resolution, use the concept of window.screen.For width, use the following −window.screen.availWidthFor height −window.screen.availHeightFollowing is the code to detect the screen resolution −Example Live Demo Document console.log("Available Width="+window.screen.availWidth); console.log("Available Height="+window.screen.availHeight); To run the above ... Read More

AmitDiwan
171 Views
The new keyword creates an object in JavaScript. To access values, use the dot notation. Following is the code −Examplefunction newObjectCreation() { this.firstName = "John"; } var newObject = new newObjectCreation(); newObject.firstName="David"; console.log("The first name="+newObject.firstName);To run the above program, you need to use the following command −node fileName.js.Here, my ... Read More

AmitDiwan
193 Views
To attach event, use document.addEventListener() in JavaScript. Following is the code −Example Live Demo Document document.addEventListener('click', function(event){ if(event.target && event.target.id== 'buttonSubmit'){ console.log("Event generation on the button click") } ... Read More

AmitDiwan
385 Views
Let’s say the following is our string −var sentence = "My, , , , , , , Name, , , , is John ,, , Smith";Use regular expression along with split() and join() to remove extra spaces and commas. Following is the code −Examplevar sentence = "My, , , , ... Read More

AmitDiwan
283 Views
Use document.getElementById() and display using innerHTML. Following is the code −Example Live Demo Document var jsonObject="name"; var value = jsonObject.split(" "); var add = {}; value.forEach(function(v){ add[v] ? add[v]++ : add[v] = "John"; ... Read More

AmitDiwan
267 Views
No, the parent object won’t get updated. Use Object.assign() with some parameters and check. Following is the code −Examplevar firstObject = { name: 'John' }; var secondObject = { name: 'Carol' }; console.log("Before merging="); console.log(firstObject); var afterMerging = Object.assign({}, firstObject, secondObject); afterMerging.name = 'Smith'; console.log("After merging="); console.log(firstObject);To run the above ... Read More

AmitDiwan
270 Views
To check for case insensitive values, use regular expression in JavaScript. Following is the code −Examplevar allNames = ['john', 'John', 'JOHN']; var makeRegularExpression = new RegExp(allNames.join( "|" ), "i"); var hasValue = makeRegularExpression.test("JOHN"); console.log("Is Present="+hasValue);To run the above program, you need to use the following command −node fileName.js.Here, my file ... Read More

AmitDiwan
4K+ Views
Let’s the following is our input type, wherein the user will search −Now, use hide() and show() to display only relevant search and hide rest. For example, on typing “Ja”, related keywords like “Java” and “JavaScript” should be visible because it begins with “Ja”.Example Live Demo Document ... Read More

AmitDiwan
1K+ Views
Let’s say the following is our table with product quantity records − qty: qty: qty: qty: Let us now hide using the hide() method. Following is the code −Example Live Demo ... Read More