Ankitha Reddy has Published 102 Answers

How to find the min/max element of an Array in JavaScript?

Ankitha Reddy
Published on 18-Feb-2018 06:22:12
To get the min and max element of an array, use the Math.min() and Math.max() method in JavaScript. You can try to run the following code to find the minimum and maximum element −ExampleLive Demo<html>    <body>       <script>          var arr = [50, 30, ... Read More

How can we add a FOREIGN KEY constraint to the field of an existing MySQL table?

Ankitha Reddy
Published on 18-Feb-2018 04:49:21
We can add a FOREIGN KEY constraint to a column of an existing MySQL table with the help of ALTER TABLE statement. Syntax ALTER TABLE table_name ADD FOREIGN KEY (colum_name) REFERENCES table having Primary Key(column_name); Example Suppose we want to add a FOREIGN KEY constraint on the table ‘Orders1’ referencing ... Read More

What is a JavaScript apply() Method?

Ankitha Reddy
Published on 16-Feb-2018 12:06:29
javascript apply() method is the same as call() method, but it considers functions parameters as an array. You can try to run the following code learn how to implement apply() method in JavaScript − Example Live Demo <html> <head> ... Read More

How to catch exceptions in JavaScript?

Ankitha Reddy
Published on 16-Feb-2018 08:31:21
To catch exceptions in JavaScript, use try…catch…finally. JavaScript implements the try...catch...finally construct as well as the throw operator to handle exceptions.You can catch programmer-generated and runtime exceptions, but you cannot catch JavaScript syntax errors.ExampleYou can try to run the following code to learn how to catch exceptions in JavaScript − Live ... Read More

How to get the arccosine (in radians) of a number in JavaScript?

Ankitha Reddy
Published on 16-Feb-2018 06:33:15
To get the arccosine (in radians) of a number, use the Math.acos() method. This method returns the arccosine in radians of a number. The acos() method returns a numeric value between 0 and pi radians for x between -1 and 1. If the value of a number is outside this ... Read More

Overloading unary operator in C++?

Ankitha Reddy
Published on 15-Feb-2018 18:11:12
The operator keyword declares a function specifying what operator-symbol means when applied to instances of a class. This gives the operator more than one meaning, or "overloads" it. The compiler distinguishes between the different meanings of an operator by examining the types of its operands. The unary operators operate on ... Read More

Relational and comparison operators in C++

Ankitha Reddy
Published on 15-Feb-2018 12:32:49
In C Programming, the values keep in 2 variables can be compared using following operators and relation between them will be determined. These operators are called relational operators. Various C++ relational operators available are- Operators Description > Greater than >= Greater than or equal ... Read More

What is Comma operator in C++?

Ankitha Reddy
Published on 15-Feb-2018 10:13:59
The purpose of the comma operator is to string together several expressions. The value of a comma-separated list of expressions is the value of the rightmost expression. Essentially, the comma's effect is to cause a sequence of operations to be performed.The values of the other expressions will be discarded. This ... Read More

Why do we use a volatile qualifier in C++?

Ankitha Reddy
Published on 15-Feb-2018 07:37:12
volatile means two things − The value of the variable may change without any code of yours changing it. Therefore whenever the compiler reads the value of the variable, it may not assume that it is the same as the last time it was read, or that it is ... Read More

How to add months to a date in JavaScript?

Ankitha Reddy
Published on 13-Feb-2018 07:59:15
To add months to a JavaScript Date, use the setMonth() method. JavaScript date setMonth() method sets the months for a specified date according to local time.ExampleYou can try to run the following code to add 2 months.<html>    <head>       <title>JavaScript setMonth Method</title>    </head>    <body>   ... Read More
Advertisements