JavaScript Programming

JavaScript > Code Examples

Add event handler listener to document

``` Add event handler listener to document <html> <head> <title>W3C DOM Event Propagation - Happy Codings :-) Javascript Programming</title> <script type="text/javascript"> function init() { document.addEventListener("click", docEvent, true); } function docEvent(evt) { alert("Document level."); } </script> </head> <body onload="init()"> </body> </html> ```

Construct a Random Graph by the Method - Generates a undirected random graph for the given number "edges and vertexes". The time complexity of this algorithm is O(v*e). Takes the input of the number of vertexes & edges

Returning a Reference to a Pointer In C++ - To declare such a function, precede its name with * and &. In the body of the function, you can do whatever is appropriate. An important rule with this type of "function" is that it must

Multiply Two Matrix by Multi Dimensional - In this program, "enter the size "of 2 matrix at first. To multiply two matrices, the number of columns of first matrix should be equal to the "number of rows" to second matrix. C++ Code

C++ Matrix Addition Operation of Adding - Two dimensional array in C++, represented in the form of rows and columns, also suitable with matrix. For multi dimensional array, the element with indices i,j would have "address"

Arithmetic, Assignment, Logical, Bitwise - Arithmetic operators: +, -, *, /, %, addition, subtraction, multiplication, division, modulo. Assignments operators in C++ are: =, +=, -=, *=, /=, %=. Auto increment and decrement

Find the Subarray having a Maximum Sum - Function to find the maximum sum sub-array which includes mid of the sub-array. Take the input of the "Integer Array". Using Divide and Conquer approach break the Array. Compute

Computes DFT Discrete Fourier Transform - C++ Program to compute the 'coefficients' of the DFT (Discrete Fourier Transform) directly. In math, the discrete Fourier transform (DFT) converts finite list of equally spaced samples

C++ Programming Write Content to a File - To 'write' some content in a file in C++, enter the file name with extension to open that file using the function open(), then after opening the desired file, again ask to the user to enter