![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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 9326 Articles for Object Oriented Programming
![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)
894 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)
55 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]
![Sravani S](https://www.tutorialspoint.com/assets/profiles/13538/profile/60_67753-1512711355.jpg)
244 Views
Use Element.innerHTML in JavaScript to display JavaScript variables in an HTML page without document.write.You can try to work through the following code snippet −var $myName = document.querySelector('.name'); var $jsValue = document.querySelector('.jsValue'); $myName.addEventListener('input', function(event){ $jsValue.innerHTML = $myName.value; }, false);
![Govinda Sai](https://www.tutorialspoint.com/assets/profiles/13542/profile/60_86497-1512650655.jpg)
426 Views
All modern browsers support SVG and you can easily create it using JavaScript. Google Chrome and Firefox both support SVG.With JavaScript, create a blank SVG document object model (DOM). Using attributes, create a shape like a circle or a rectangle.var mySvg = "http://www.w3.org/2000/svg"; var myDoc = evt.target.ownerDocument; var myShape = svgDocument.createElementNS(mySvg, "circle"); myShape.setAttributeNS(null, "cx", 40); myShape.setAttributeNS(null, "cy", 40); myShape.setAttributeNS(null, "r", 30); myShape.setAttributeNS(null, "fill", "yellow");
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
586 Views
Access the buf.buffer property directly to convert a binary NodeJS Buffer to JavaScript ArrayBuffer. The write through the original Buffer instance writes the ArrayBufferView.Keep in mind that the instances of Buffer are also instances of Uint8Array in node.js 4.x and higher versions.ExampleYou can try the following code snippet to convert a NodeJS buffer to JavaScript ArrayBuffer −function toArrayBuffer(myBuf) { var myBuffer = new ArrayBuffer(myBuf.length); var res = new Uint8Array(myBuffer); for (var i = 0; i < myBuf.length; ++i) { res[i] = myBuf[i]; } return myBuffer; }
![Srinivas Gorla](https://www.tutorialspoint.com/assets/profiles/13556/profile/60_78057-1512712331.jpg)
291 Views
"" Outputs a newline (in the appropriate platform-specific representation, so it generates a "\r" on Windows), but std::endl does the same AND flushes the stream. Usually, you don't need to flush the stream immediately and it'll just cost you performance, so, for the most part, there's no reason to use std::endl.When you want to flush the stream manually because you expect your output to be made visible to the user in a timely manner(ie without delay), you should use std::endl instead of writing '' to the stream.
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
197 Views
JavaScript automatically allocates memory, while a variable is declared. Garbage collection finds memory no longer used by the application and releases it since it is of no use. Garbage collector uses algorithms like Mark-and-sweep algorithm, to find the memory no longer used.This algorithm is used to free memory when an object is unreachable. The garbage collector identifies the objects, which are reachable or unreachable. These unreachable objects get the treatment from the automatic garbage collector.The Reference-Counting Garbage Collection is also used for garbage collection in JavaScript. The object will get automatically garbage collected if there are no references to it. ... Read More