- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9313 Articles for Object Oriented Programming
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
549 Views
For this, you need to use “flex-direction” concept of CSS. Let’s say the following is our CSS style − .demo{ display: flex; flex-direction: column-reverse; } Now, set the div position relative to another div −Example Live Demo Document .demo{ display: flex; flex-direction: column-reverse; } DIV_DEMO1 DIV_DEMO2 To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open with Live Server” in VS Code editor.OutputThis will produce the following output −
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
153 Views
You can use keyword async as well as await. Following is the code −Exampleasync function test(i) { while (i node demo73.js Call Demo1() Call Demo2() Call Demo1() Call Demo2() Call Demo1() Call Demo2() Call Demo1() Call Demo2() Call Demo1() Call Demo2() Call Demo1() Call Demo2() Call Demo1() Call Demo2() Call Demo1() Call Demo2() Call Demo1() Call Demo2() Call Demo1() Call Demo2()
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
985 Views
To get value of any attribute from XML data, use attr() in JavaScript. Following is the code −Example Live Demo Document var yourXMLDetails = '' +'' +'' +'' console.log("Game Details==="+$(yourXMLDetails).attr("details")); To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open with Live Server” in VS Code editor.OutputThis will produce the following output −
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
194 Views
Let’s say the following is our object −var customerDetails= [ { customerId:101, customerName:"John" }, { customerId:102, customerName:"David" }, { customerId:103, customerName:"Mike" }, { customerId:104, customerName:"Bob" } ]Use for loop with the following condition to display only odd CustomerID records −for(var index=0;index
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
You can use the concept of createHTMLDocument(). Following is the code −Example Document const htmlDocument = document.implementation.createHTMLDocument(); const customURL = htmlDocument.createElement( 'base' ); customURL.href = "https://www.tutorialspoint.com/java/index.htm"; htmlDocument.head.append( customURL ); console.log("Base URL="+customURL.href); const modifiedURL = htmlDocument.createElement("a"); modifiedURL.href = "../java/java_questions_answers.html"; htmlDocument.body.append( modifiedURL ); console.log("After Modifying URL="+ modifiedURL.href ); To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open with Live Server” in VS Code editor.OutputThis will produce the following output: on ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
To select all elements with “data-“ attribute, use document.querySelectorAll(“”). Following is the code −Example Live Demo Document var result=document.querySelectorAll('[data-sentence]'); for (var index in result){ if (result.hasOwnProperty(index)){ console.log(result[index].getAttribute('data-sentence')); } } To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open with Live Server” in VS Code editor.OutputThis will produce the following output −
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
To match multiple occurrences in a string, use regular expressions. Following is the code −Examplefunction checkMultipleOccurrences(sentence) { var matchExpression = /(JavaScript?[^\s]+)|(typescript?[^\s]+)/g; return sentence.match(matchExpression); } var sentence="This is my first JavaScript Program which is the subset of typescript"; console.log(sentence); console.log(checkMultipleOccurrences(sentence));To run the above program, you need to use the following command −node fileName.js.Here, my file name is demo70.js.OutputThis will produce the following output −PS C:\Users\Amit\JavaScript-code> node demo70.js This is my first JavaScript Program which is the subset of typescript [ 'JavaScript', 'typescript' ]
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
718 Views
A matrix can be converted into a pixel’s image of matrix. It is defined as the area of the matrix which contains pixels with equal or different sizes of left, right, bottom and upper.We can create this by using image function and its argument useRaster with the matrix data.Example Live Demo> M par(mar=c(5,5,5,5)) > image(M,useRaster=TRUE,axes=FALSE)Output> par(mar=c(10,10,10,10)) > image(M,useRaster=TRUE,axes=FALSE)Output> par(mar=c(2,2,2,2)) > image(M,useRaster=TRUE,axes=FALSE)OutputPixel matrix with grey color −> image(M,axes=FALSE,col=grey(seq(0,1,length=180)))Output
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
298 Views
The includes() check whether array has a specific element, whereas splice() is used to add/remove items. Following is the code −ExampledeleteElementsFromArray = function(elements, ...values) { let elementRemoved = Array.from(values); for (var index = 0; index < elements.length; index++){ if (elementRemoved.includes(elements[index])){ elements.splice(index, 1); index--; } } return elements; } console.log(deleteElementsFromArray([80,90,56,34,79], 90, 34,79));To run the above program, you need to use the following command −node fileName.js.Here, my file name is demo69.js.OutputThis will produce the following output −PS C:\Users\Amit\JavaScript-code> node demo69.js [ 80, 56 ]
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
413 Views
You can use a for loop and check whether the percentage is greater than 70 or not with if condition.Following are the records of each student −const studentDetails= [ { studentName:"John", percentage:78 }, { studentName:"Sam", percentage:68 }, { studentName:"Mike", percentage:88 }, { studentName:"Bob", percentage:70 } ]Now, use the for loop and et conditions for students with percentage more than 70 −for(var index=0;index 70) { ... Read More