Arjun Thakur has Published 1109 Articles

Why is [1,2] + [3,4] = “1,23,4” in JavaScript?

Arjun Thakur

Arjun Thakur

Updated on 24-Jun-2020 06:41:33

56 Views

The JavaScript's + operator is used to add two numbers or join two strings. However, use the contact() method to join two arrays to get a new one. For example, [50, 70].concat([90, 100])The above prints, [50, 70, 90, 100]Let’s see your example. The + operator concats strings, and converts the ... Read More

How to convert the image into a base64 string using JavaScript?

Arjun Thakur

Arjun Thakur

Updated on 24-Jun-2020 06:36:26

484 Views

To convert the image into a base64 string using JavaScript, use the FileReader API. You can try to run the following code to get base64string for an image −Example                    function toDataURL(url, callback) {             ... Read More

Set a CSS style for the element when the animation is not playing

Arjun Thakur

Arjun Thakur

Updated on 24-Jun-2020 06:35:03

73 Views

Use the animation-fill-mode property to set a style for the element when the animation is not playingExampleLive Demo                    div {             width: 150px;             height: 200px;             position: relative;             background: red;             animation-name: myanim;             animation-duration: 2s;             animation-fill-mode: backwards;          }          @keyframes myanim {             from {left: 0px; background-color: green;}             to {left: 200px; background-color: blue;}          }                        

How do I print a double value with full precision using cout in C++?

Arjun Thakur

Arjun Thakur

Updated on 24-Jun-2020 06:34:50

942 Views

The output stream cout allows using manipulators that you can use to set the precision directly on cout and use the fixed format specifier. To get the full precision of a double, you can use the limits library. For example, Example#include #include using namespace std; int main() {   ... Read More

Selects all elements that are placed immediately after

Arjun Thakur

Arjun Thakur

Updated on 24-Jun-2020 06:26:54

274 Views

Use the element+element selector to select elements placed after first specified element. You can try to run the following code to implement this,ExampleLive Demo                    div + p {             color: white;             background-color: blue;          }                     Demo Website       Fruits                This is demo text.             Fruits are good for health.       Fruits makes you healthy.    

Is segmentation fault actual undefined behavior in C++?

Arjun Thakur

Arjun Thakur

Updated on 24-Jun-2020 06:08:41

350 Views

Undefined behavior is a way to give freedom to implementors (e.g. of compilers or of OSes) and to computers to do whatever they "want", in other words, to not care about consequences.The cases in which segmentation fault occurs are transient in nature. They won't always result in a segmentation fault ... Read More

Selects every element whose alt attribute value begins with "Tutor" with CSS

Arjun Thakur

Arjun Thakur

Updated on 24-Jun-2020 06:00:06

96 Views

Use the [attribute|=”value”] selector to select elements with the specified attribute starting with a specified value.You can try to run the following code to implement CSS [attribute|=”value”] Selector,ExampleLive Demo                    [alt|=Tutor] {             border: 5px solid orange;             border-radius: 5px;          }                              

CSS transition-duration property

Arjun Thakur

Arjun Thakur

Updated on 24-Jun-2020 05:34:36

95 Views

Use the transition-duration property to set the duration of transitionExampleLive Demo                    div {             width: 150px;             height: 150px;             background: blue;             transition-property: height;             transition-duration: 2s;          }          div:hover {             height: 200px;          }                     Heading One       Hover over the below box to change its height.          

Build a radial gradient with the shape of a circle

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 16:27:08

184 Views

To create a circle with radial gradient, you can try to run the following code. Set another parameter in radial gradient for shapes like circleExampleLive Demo                    #demo {             height: 400px;             background: radial-gradient(circle, red , blue, yellow);          }                     Radial Gradient       Radial Gradients    

Selects all elements with a lang attribute value starting with "en" with CSS

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 15:43:53

137 Views

Use the [attribute|=”value”] selector to select elements with the specified attribute starting with a specified value.You can try to run the following code to implement CSS [attribute|=”value”] Selector,ExampleLive Demo                    [lang| = en] {             border: 5px solid orange;             border-radius: 5px;          }                     Hello       Hei    

Advertisements