Mkotla has Published 77 Articles
mkotla
2K+ Views
The following global error handler will show how to catch unhandled exception −Example window.onerror = function(errMsg, url, line, column, error) { var result = !column ? '' : 'column: ' + column; result += !error; document.write("Error= " + errMsg + "url= " + url + "line= " + line + result); var suppressErrorAlert = true; return suppressErrorAlert; }; setTimeout(function() { eval("{"); }, 500)
mkotla
249 Views
You can access a dictionary value to a variable in Python using the access operator []. examplemy_dict = { 'foo': 42, 'bar': 12.5 } new_var = my_dict['foo'] print(new_var)OutputThis will give the output −42You can also access the value using the get method on the dictionary. examplemy_dict = { 'foo': 42, ... Read More
mkotla
5K+ Views
Use the following to check if audio is playing −functionisPlaying(audelem) { return!audelem.paused; }The above code can be used to check ifaudio is playing or not. The audio tag has a paused property.The paused property returns whether the audio/video is paused.You can also toggle −functiontogglePause() { if(newAudio.paused && newAudio.currentTime > 0 ... Read More
mkotla
297 Views
Use the autofocus attribute to specify that the element should get focus automatically on page load in HTML −ExampleYou can try to run the following code to learn how to implement autofocus attribute in HTML − Click on the below button to generate an alert box. Result
mkotla
2K+ Views
Java does not support multiple inheritance. This means that a class cannot extend more than one class. Therefore, following is illegal −Examplepublic class extends Animal, Mammal{}However, a class can implement one or more interfaces, which has helped Java get rid of the impossibility of multiple inheritance.The extends keyword is used ... Read More
mkotla
3K+ Views
You can either setLength to be 0 or create a new StringBuilder() instance. See the example below −Examplepublic class Tester { public static void main(String[] args) { StringBuilder builder = new StringBuilder(); builder.append("sample"); System.out.println(builder.toString()); builder.setLength(0); ... Read More
mkotla
2K+ Views
Download the latest version of Java from the official site. Run the .exe to install Java on your machine. Once you installed Java on your machine, you will need to set environment variables to point to correct installation directories −Setting Up the Path for Windows:Assuming you have installed Java in ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP