- 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 9321 Articles for Object Oriented Programming
![Lokesh Badavath](https://www.tutorialspoint.com/assets/profiles/538106/profile/60_1039031-1666073315.jpg)
20K+ Views
We use getIframeContent(frameId), to get the object reference of an iframe in JavaScript. To get the element in an iframe, first we need access the element inside the JavaScript using the document.getElementById() method by passing iframe id as an argument. Using iframetag The tag in HTML specifies an inline frame. This inline frame is used to embed another document within the current HTML document. The element is supported in every browser like (Google Chrome, Microsoft edge/ internet explorer, Firefox, safari, and opera). We are using srcdoc attribute in tag to specify the HTML content of ... Read More
![Lokesh Badavath](https://www.tutorialspoint.com/assets/profiles/538106/profile/60_1039031-1666073315.jpg)
37K+ Views
In this article, we are going to learn how to read data from *.CSV file using JavaScript. To convert or parse CSV data into an array, we need JavaScript’s FileReader class, which contains a method called readAsText() that will read a CSV file content and parse the results as string text. If we have the string, we can create a custom function to turn the string into an array. To read a CSV file, first we need to accept the file. Now let’s see how to accept the csv file from browser using HTML elements. Example Following is the example ... Read More
![Lokesh Badavath](https://www.tutorialspoint.com/assets/profiles/538106/profile/60_1039031-1666073315.jpg)
154 Views
In this article we are going to learn how to understand JavaScript module pattern. The Module pattern is used to copy the concept of classes, so that we can store both public and private methods and variables inside a single object. Since JavaScript doesn’t support classes, similar to classes that are used in other programming languages like Java or Python. Why use modules? Maintainability − A module is self-contained and aims to lessen the dependencies, so that it can grow and improve independently. Name spacing − In JavaScript, variables outside the scope of a top-level function are global. Because ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
484 Views
To convert the image into a base64 string using JavaScript, use the FileReader API. You can try to run the following code to get base64string for an image −Example function toDataURL(url, callback) { var httpRequest = new XMLHttpRequest(); httpRequest.onload = function() { var fileReader = new FileReader(); fileReader.onloadend = function() { callback(fileReader.result); } fileReader.readAsDataURL(httpRequest.response); }; httpRequest.open('GET', url); httpRequest.responseType = 'blob'; httpRequest.send(); } toDataURL('https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg', function(dataUrl) { document.write('Result in string:', dataUrl) })
![Lokesh Badavath](https://www.tutorialspoint.com/assets/profiles/538106/profile/60_1039031-1666073315.jpg)
4K+ Views
In this article, we are going to discuss how to work with JavaScript Drag and drop for touch devices in JavaScript. Using JavaScript, we can only drag an image and some text. To drag an image, we simply hold the mouse button down and then move it. To drag the text, we need to highlight some text and drag it in the same way as image. HTML5 specifies almost all elements can be draggable. To make an element draggable, we add the draggable property with the value of true to its HTML element tag. Syntax Following is the syntax ... Read More
![Lokesh Badavath](https://www.tutorialspoint.com/assets/profiles/538106/profile/60_1039031-1666073315.jpg)
905 Views
In this article we are going to try how to secretly copy a JavaScript function to the clipboard. We use the copytext() method to secretly copy JavaScript function to the clipboard. These functions work on JavaScript console as well. To understand better let’s look into the examples one by one. Example Following is the example program we used copyText() method to copy text to clipboard using JavaScript function. Copy text ... Read More
![Nikitha N](https://www.tutorialspoint.com/assets/profiles/13558/profile/60_76068-1512713229.jpg)
49 Views
Yes, you can use the JavaScript Array.sort() method for shuffling. Let’s see howExamplefunction shuffleDisplay(arr) { var tmp, current; // calculating length var top = arr.length; if(top) while(--top) { current = Math.floor(Math.random() * (top + 1)); tmp = arr[current]; arr[current] = arr[top]; arr[top] = tmp; } return arr; }
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
56 Views
The JavaScript's + operator is used to add two numbers or join two strings. However, use the contact() method to join two arrays to get a new one. For example,[50, 70].concat([90, 100])The above prints,[50, 70, 90, 100]Let’s see your example. The + operator concats strings, and converts the arrays to strings −[1,2] + [3,4] '1,2' + '3,4' 1,23,4Or as mentioned above, use concat(),[1,2].concat([3,4]) [1,2,3,4]