
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
423 Views
Let’s say we have the following records of studentId and studentName and want to check a specific student name −const studentDetails= [ { studentId:101, studentName:"John" }, { studentId:102, studentName:"David" }, { ... Read More

AmitDiwan
1K+ Views
In order to convert string into camel case, you need to lowercase the first letter of the word and the first letter of the remaining words must be in capital.Following is the code to convert any string into camel case −Examplefunction convertStringToCamelCase(sentence) { return sentence.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(camelCaseMatch, i) { ... Read More

AmitDiwan
450 Views
To display only the current year, use getFullYear(). Following is the code −Example Live Demo Document The Current Year= document.getElementById("theCurrentYear").innerHTML = new Date().getFullYear(); To run the above program, save the file name “anyName.html(index.html)” and right ... Read More

AmitDiwan
2K+ Views
For this, you can use replace() along with parse(). Following is the code −Examplevar studentDetails = `"{""name"": ""John"", ""subjectName"": ""Introduction To JavaScript""}"`; console.log("The actual object="); console.log(studentDetails); var removeFirstAndLast = studentDetails.substring(1, studentDetails.length-1) var removeDoubleQuotes = removeFirstAndLast.replace(/""/gi, `"`) console.log(removeDoubleQuotes) var output = JSON.parse(removeDoubleQuotes); console.log(output);To run the above program, you need to use ... Read More

AmitDiwan
168 Views
The Object.assign() method is used to copy one or more source objects to a target object. It invokes getters and setters since it uses both 'get' on the source and 'Set' on the target.The syntax is as follows −Object.assign(target, ...source objects);Following is the code to copy object −Examplevar object = ... Read More

AmitDiwan
307 Views
Let’s say the following are our elements −My Name is John My Name is David My Name is Bob My Name is Mike My Name is Carol ENDWe need to remove theelement and its content. Theelements are in between the START and END.To remove elements between two elements, use the ... Read More

AmitDiwan
823 Views
For this, use document.querySelectorAll(). With that, also use the getElementsByClassName(). Following is the code −Example Live Demo Document My Name is John My h6 value must be here... My h6 value must be here... My h6 ... Read More

AmitDiwan
433 Views
Let’s say the following are our array of objects −var studentDetails = [ { firstName: "John", listOfSubject: ['MySQL', 'MongoDB']}, {firstName: "David", listOfSubject: ['Java', 'C'] }]We need to add the following in the already created array of objects −{firstName: "Bob", listOfSubject: ['JavaScript']};Examplevar studentDetails = [ { firstName: "John", ... Read More

AmitDiwan
644 Views
Let’s say the following are our objects −var first = {key1: 100, key2: 40, key3: 70} var second = {key2: 80, key3: 70, key4: 1000}You can use the concept of hasOwnProperty() to add properties from one object to another. Following is the code −Examplevar first = {key1: 100, key2: 40, ... Read More