Abhinaya has Published 62 Articles

How to remove first array element in JavaScript and return it?

Abhinaya

Abhinaya

Updated on 18-Jun-2020 09:17:42

151 Views

To remove first array element, use the JavaScript shift() method. JavaScript array shift() method removes the first element from an array and returns that element.ExampleYou can try to run the following code to remove first array element and return it −Live Demo           JavaScript Array shift Method ... Read More

How to Plot Complex Numbers in Python?

Abhinaya

Abhinaya

Updated on 18-Jun-2020 06:38:34

2K+ Views

You can plot complex numbers on a polar plot. If you have an array of complex numbers, you can plot it using:import matplotlib.pyplot as plt import numpy as np cnums = np.arange(5) + 1j * np.arange(6, 11) X = [x.real for x in cnums] Y = [x.imag for x ... Read More

How to overwrite a specific chunk in a byte array using java?

Abhinaya

Abhinaya

Updated on 16-Jun-2020 10:02:01

1K+ Views

Java provides a ByteBuffer class which allows you to wrap an array into a byte buffer using its wrap() method. Once you did that you can replace the contents of the buffer using the position(): To select the starting position and, put(): To replace the data methods:ExampleLive Demoimport java.nio.ByteBuffer; public ... Read More

How to arguments object with Rest, default, and destructured parameters in JavaScript?

Abhinaya

Abhinaya

Updated on 15-Jun-2020 13:19:37

67 Views

defaultThis came to handle function parameters with ease. Easily set Default parameters to allow initializing formal parameters with default values. This is possible only if no value or undefined is passed. Let’s see an exampleExampleLive Demo                    // default is set ... Read More

What is the role of screenY Mouse Event in JavaScript?

Abhinaya

Abhinaya

Updated on 23-May-2020 09:36:35

54 Views

When an event is triggered, the screenY mouse event returns the vertical coordinate of the mouse pointer.ExampleYou can try to run the following code to learn how to implement screenY Mouse event in JavaScript.           Click here to get the x (horizontal) and y (vertical) ... Read More

What is the usage of onfocusout event in JavaScript?

Abhinaya

Abhinaya

Updated on 22-May-2020 11:16:24

199 Views

The onfocusin event triggers when an element is to lose focus. You can try to run the following code to learn how to implement onfocusout event in JavaScript.Example           Write below:       After losing focus, the background color of input check will change.                      function newFunc(x) {             x.style.background = "blue";          }          

What is JavaScript Bitwise XOR (^) Operator?

Abhinaya

Abhinaya

Updated on 20-May-2020 10:50:12

177 Views

If both the bits are different, then 1 is returned when Bitwise OR (|) operator is used.ExampleYou can try to run the following code to learn how to work with JavaScript Bitwise XOR Operator.                    document.write("Bitwise XOR Operator");          // 7 = 00000000000000000000000000000111          // 1 = 00000000000000000000000000000001          document.write(7 ^ 1);          

How to generate a random 128 bit strings using Python?

Abhinaya

Abhinaya

Updated on 05-Mar-2020 10:21:59

2K+ Views

You can generate these just random 128-bit strings using the random module's getrandbits function that accepts a number of bits as an argument. exampleimport random hash = random.getrandbits(128) print(hex(hash))OutputThis will give the output −0xa3fa6d97f4807e145b37451fc344e58c

How to generate XML using Python?

Abhinaya

Abhinaya

Updated on 05-Mar-2020 10:14:32

1K+ Views

To generate XML from a python dictionary, you need to install the dicttoxml package. You can install it using −$ pip install dicttoxmlOnce installed, you can use the dicttoxml method to create the xml. examplea = {    'foo': 45,    'bar': {       'baz': "Hello"    } } ... Read More

How can we use Python Ternary Operator Without else?

Abhinaya

Abhinaya

Updated on 05-Mar-2020 07:37:19

959 Views

If you want to convert a statement like −if :    to a single line, You can use the single line if syntax to do so −if : Another way to do this is leveraging the short-circuiting and operator like − and If is false, then short-circuiting will kick ... Read More

Advertisements