What are public and private variables in Python class?

Rajendra Dharmkar
Published on 22-Jan-2018 18:27:16
Public VariablesPython doesn’t restrict us from accessing any variable or calling any member method in a python program.All python variables and methods are public by default in Python. So when we want to make any variable or method public, we just do nothing. Let us see the example below −Exampleclass ... Read More

How can I use goto statement in JavaScript?

Abhinanda Shri
Published on 22-Jan-2018 14:48:11
JavaScript goto statement is a reserved keyword. Generally, according to web standards it isn’t considered a good practice to use goto statement.Using goto with JavaScript preprocessing is still considered good as shown below.var a = 0; [lbl] beginning: console.log("Demo Text!"); a++; if(i < 424) goto beginning;The above code gets translated ... Read More

How to break a loop in JavaScript?

Ankitha Reddy
Published on 22-Jan-2018 14:44:13
The break statement is used to break a loop and continue executing the code, which is after the loop.ExampleYou can try to run the following code to break a loop in JavaScriptLive Demo<!DOCTYPE html> <html>    <body>       <p id="test"></p>       <script>         ... Read More

How do I enumerate functions of a Python class?

Rajendra Dharmkar
Published on 22-Jan-2018 17:48:22
The following code prints the list of functions of the given class as followsExampleclass foo:     def __init__(self):         self.x = x     def bar(self):         pass     def baz(self):         pass print (type(foo)) import inspect print(inspect.getmembers(foo, predicate=inspect.ismethod))OutputThe ... Read More

What is Bitwise XOR Assignment Operator (^=) in JavaScript?

Abhinaya
Published on 22-Jan-2018 14:38:18
It performs XOR operation on the right operand with 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 Bitwise XOR Assignment OperatorLive Demo<html>    <body>       <script>          var a ... Read More

What is Bitwise XOR Operator (^) in JavaScript?

V Jyothi
Published on 22-Jan-2018 14:32:24
It performs a Boolean exclusive OR operation on each bit of its integer arguments. Exclusive OR means that either operand one is true or operand two is true, but not both.ExampleYou can try to run the following code to learn how to work with Bitwise XOR OperatorLive Demo<html>    <body> ... Read More

How to check for “undefined” variable in JavaScript?

Samual Sam
Published on 18-Jan-2018 17:20:27
On getting the result of the following, you can find whether a variable is ‘undefined’. If the result is “false”, it means the variable is undefined. Here, the variable results in “True” Example Live Demo <html> <body> ... Read More

How to unset a JavaScript variable?

Sai Subramanyam
Published on 18-Jan-2018 17:17:57
To unset a variable in JavaScript, use the undefined. After that, use delete operator to completely remove it.Let’s try the code snippet again.var str = “Demo Text”; window.onscroll = function() {    var y = this.pageYOffset;    if(y > 200) {       document.write(nxt);       nxt = ... Read More

How to determine if a variable is 'undefined' or 'null'?

Swarali Sree
Published on 18-Jan-2018 17:24:06
On getting the result of the following, you can find whether a variable is null or undefined. If the result is “false”, it means the variable is null and undefined.Here, the variable results in “True” −<html>    <body>       <script>          var age = 10; ... Read More

How to minimize the use of global variables in JavaScript?

Johar Ali
Published on 11-Jan-2018 17:13:52
A global variable has global scope which means it can be defined anywhere in your JavaScript code. To minimize the usage of global variables, use consistent variables around different parts of your project.var myValue = {    common: function(){       //Add code    },    val1: {   ... Read More
Advertisements