A block statement groups zero or more statements. In languages other than JavaScript, it is known as a compound statement.SyntaxHere’s the syntax −{ //List of statements }To add a label to a block, use the following −Identifier_for_label: { StatementList }Let’s use it for break statement. You can try to run the following code to use labels to control the flow, with break statementExampleLive Demo document.write("Entering the loop! "); outerloop: // This is the label name for (var i = ... Read More
Djikstra's algorithm is used to find distance/path of the shortest path from one node to all other nodes. There are cases where we need to find shortest paths from all nodes to all other nodes. This is where the All pairs shortest path algorithms come in handy. The most used all pairs shortest path algorithm is Floyd Warshall algorithm.Floyd Warshall algorithm works as follows −We initialize an N x N matrix of distances to be Infinity.Then for each edge u, v, we update this matrix to be showing the weight of this edge and for edges v, v we update ... Read More
A minimum spanning tree (MST) or minimum weight spanning tree is a subset of the edges of a connected, edge-weighted (un)directed graph that connects all the vertices together, without any cycles and with the minimum possible total edge weight. That is, it is a spanning tree whose sum of edge weights is as small as possible.
Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. It finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized.The algorithm operates by building this tree one vertex at a time, from an arbitrary starting vertex, at each step adding the cheapest possible connection from the tree to another vertex.How does Prim's algorithm work?Let us look at an illustration of how Prim's algorithm works −1. Choose any arbitrary node as the root node: In this ... Read More
The HTML DOM Input Date type property returns/sets type of Input Date.SyntaxFollowing is the syntax −Returning string valueinputDateObject.typeSetting type to string valueinputDateObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailsdateIt defines that input type is dateradioIt defines that input type is radiocheckboxIt defines that input type is checkboxExampleLet us see an example of Input Date type property − Live Demo Input Date type Calendar: Change Type var divDisplay = document.getElementById("divDisplay"); var inputDate = document.getElementById("dateSelect"); divDisplay.textContent = 'Input type: '+ inputDate.type; function changeType(){ ... Read More
There could be multiple reasons that this error comes up. Try below steps:Adobe Global Security Settings changesMade entries in windows host file andAdded SAP server as trusted site in IEThis purely seems to be a security setting issue in Adobe Flash Player. There are various SAP notes that you can search however I am not aware any relevant one.
The scope of a variable is the region of your program in which it is defined. JavaScript variables have only two scopes.Global Variables − A global variable has a global scope which means it can be defined anywhere in your JavaScript code.Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.Within the body of a function, a local variable takes precedence over a global variable with the same name. If you declare a local variable or function parameter with the same name as a global ... Read More
Kruskal's algorithm is a greedy algorithm that works as follows −1. It Creates a set of all edges in the graph.2. While the above set is not empty and not all vertices are covered, It removes the minimum weight edge from this setIt checks if this edge is forming a cycle or just connecting 2 trees. If it forms a cycle, we discard this edge, else we add it to our tree.3. When the above processing is complete, we have a minimum spanning tree.In order to implement this algorithm, we need 2 more data structures.First, we need a priority queue ... Read More
document.onloadIt gets fired prior to loading of images and other external content. document.onload event is fired before the window.onload.window.onloadIt gets fired when the complete page loads, which includes images, scripts, css, etc.ExampleHere’a an example to understand onload.Live Demo JavaScript Animation Click button below to move the image to right
A block statement groups zero or more statements. In languages other than JavaScript, it is known as a compound statement.SyntaxHere’s the syntax −{ //List of statements }Variables with a block get scoped to the containing function. Block statement never introduce scope and using var to declare variables don’t have block scope.var a = 20; { var b = 40; }Now, when you will print the value of a, it will print 40, not 20. This is because variable declared with a var within the block has the same scope like var before the block.var a = 20; { var a = 40; } // this prints 40 document.write(a);
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP