The addition operator is used to add two operands.ExampleYou can try to run the following code to work with Addition Operator − var a = 33; var b = 10; document.write("a + b = "); result =a + b; document.write(result);
It adds the right operand to the left operand and assigns the result to the left operand.ExampleYou can try to run the following code to learn how to work with Addition Assignment Operator − var a = 33; var b = 10; document.write("Value of a => (a += b) => "); result = (a += b); document.write(result); document.write(linebreak);
A boolean variable in JavaScript has two values True or False.ExampleYou can try to run the following code to learn how to work with Boolean variables − 35 > 20 Click for result function myValue() { document.getElementById("test").innerHTML = Boolean(35 > 20); }
JavaScript is untyped language. This means that a JavaScript variable can hold a value of any data type. To declare variables in JavaScript, you need to use the var keyword. Whether it is a number or string, use the var keyword for declaration.Here’s how you can declare numbers in JavaScript −var points = 100; var rank = 5;ExampleYou can try to run the following code to learn how to declare number in JavaScript −
This operator is just like the >>operator, except that the bits shifted in on the left are always zero i.e. xeroes are filled in from the left.ExampleYou can try to run the following code to learn how to work with unsigned right shift operator − var a =-14; var b =2; // Shift right two bits document.write("(a >>> b) => "); result =(a >>> b); document.write(result);
There's no validate method as almost anything is a valid URL. There are some punctuation rules for splitting it up. Without any punctuation, you still have a valid URL.Depending on the situation, we use following methods.If you trust the data, and just want to verify if the protocol is HTTP, then urlparse is perfect.If you want to make the URL is actually a true URL, use the cumbersome and maniacal regexIf you want to make sure it's a real web address, use the following codeExampleimport urllib try: urllib.urlopen(url) except IOError: print "Not a real URL"Read More
From Python documentationNon-special characters match themselves. Special characters don't match themselves −\ Escape special char or start a sequence..Match any char except newline, see re.DOTALL^Match start of the string, see re.MULTILINE $ Match end of the string, see re.MULTILINE[ ]Enclose a set of matchable charsR|S Match either regex R or regex S.()Create capture group, & indicate precedenceAfter '[', enclose a set, the only special chars are −]End the set, if not the 1st char-A range, eg. a-c matches a, b or c^Negate the set only if it is the 1st char Quantifiers (append '?' for non-greedy) −{m}Exactly m repetitions {m, n}From m (default 0) ... Read More
Avoid global variables or minimize the usage of global variables in JavaScript. This is because global variables are easily overwritten by other scripts. Global Variables are not bad and not even a security concern, but it shouldn’t overwrite values of another variable.On the usage of more global variables in our code, it may lead to a maintenance issue. Let’s say we added a variable with the same name. In that case, get ready for some serious bugs.To avoid the usage of global variables, use the local variables and wrap your code in closures. You can also avoid this by wrapping ... Read More
Inline JavaScript Code − If you are adding some JavaScript code in an HTML file without using the src tag then it is known as inline JavaScript code. That’s all you need to know.
Here are two basic examples of Python regular expressionsThe re.match() method finds match if it occurs at start of the string. For example, calling match() on the string ‘TP Tutorials Point TP’ and looking for a pattern ‘TP’ will match. However, if we look for only Tutorials, the pattern will not match. Let’s check the code.Exampleimport re result = re.match(r'TP', 'TP Tutorials Point TP') print resultOutputThe re.search() method is similar to re.match() but it doesn’t limit us to find matches at the beginning of the string only. Unlike in re.match() method, here searching for pattern ‘Tutorials’ in the string ‘TP ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP