Tutorialspoint

How to create a small font text using JavaScript?

With JavaScript, which method is to be used to change the font size of a text and make it a small font? Let’s say the following is my JavaScript variable declaration: , I want to change t.....
Anjana
Answered on 17th Jan, 2018

To create a small font text with JavaScript, use the small() method. This method causes a string to be displayed in a small font as if it were in a <small> tag.You can try to run the following code to create a small font using JavaScript:ExampleLive Demo<html>    <head>   ... Read More

How to create a strikethrough text using JavaScript?

With JavaScript, which method is to be used to create a strikethrough text? Let’s say the following is my JavaScript variable declaration: ,
Akshaya Akki
Answered on 17th Jan, 2018

To create a strikethrough text with JavaScript, use the strike() method. This method causes a string to be displayed as struck-out text as if it were in a <strike> tag.You can try to run the following code to create a strikethrough text:ExampleLive Demo<html>    <head>       <title>JavaScript String ... Read More

How to make a text italic using JavaScript?

With JavaScript, which method is to be used to make the text italic? Let’s say the following is my JavaScript variable declaration: , I want to change the style of the following string to.....
Manikanth Mani
Answered on 17th Jan, 2018

To make text italic using JavaScript, use the italics() method. This method causes a string to be italic as if it were in an <i> tag.You can try to run the following code to make a text italic with JavaScript:ExampleLive Demo<html>    <head>       <title>JavaScript String italics() Method</title> ... Read More

How to change the font color of a text using JavaScript?

With JavaScript, which method is to be used to change the font color of a text? Let’s say the following is my JavaScript string declaration: , I want to change the font color of the strin.....
Ayyan
Answered on 17th Jan, 2018

To change the font color of a text, use the fontcolor() method. This method causes a string to be displayed in the specified color as if it were in a <font color="color"> tag. You can try to run the following code to change the font color of a text using JavaScript:ExampleLive ... Read More

Explain str() vs repr() functions in Python

Explain str() vs repr() functions in Python
Rajendra Dharmkar
Answered on 18th Jan, 2018

The official Python documentation says __repr__ is used to find the “official” string representation of an object and __str__ is used to find the “informal” string representation of an object. The print statement and str() built-in function uses __str__ to display the string representation of the object while the repr() ... Read More

How to create a bold text using JavaScript?

With JavaScript, which method is to be used to convert a normal text to a bold text? Let’s say the following is my JavaScript string declaration: , I want to change make the following str.....
Anjana
Answered on 17th Jan, 2018

To create a bold text using JavaScript, use the bold() text. This method causes a string to be displayed as bold as if it were in a <b> tag.You can try to run the following code to create a bold text with JavaScript:ExampleLive Demo<html>    <head>       <title>JavaScript ... Read More

How to convert a string into the lower case using JavaScript?

With JavaScript, how can I convert a string into lower case? Let’s say the following is my variable declaration in JavaScript Strings and I want a lower case form of it: , Which method sh.....
Akshaya Akki
Answered on 17th Jan, 2018

To convert a string into lower case, use the JavaScript toLowerCase() method. This method returns the calling string value converted to lowercase.You can try to run the following code to convert a string into the lower case:ExampleLive Demo<html>    <head>       <title>JavaScript String toLowerCase() Method</title>    </head> ... Read More

How to convert a string into upper case using JavaScript?

With JavaScript, how can I convert a string into the upper case? Let’s say the following is my variable declaration in JavaScript Strings and I want an upper case form of it: , Which meth.....
Manikanth Mani
Answered on 17th Jan, 2018

To convert a string into upper case, use the JavaScript toUpperCase() method. This method returns the calling string value converted to uppercase.You can try to run the following code to convert a string into the upper case:ExampleLive Demo<html>    <head>       <title>JavaScript String toUpperCase() Method</title>    </head> ... Read More

What is the difference between substr() and substring() in JavaScript?

How can I differentiate between the following, since they both give the same output: , and ,
Alankritha Ammu
Answered on 17th Jan, 2018

The examples given above have the same output, but yes the method differs, with that the parameters too.The substring() method the second parameter is the index to stop the search, whereas the second parameter of substr() is the maximum length to return.Let’s see an example for substr() method in JavaScript:ExampleLive ... Read More

How to get the last index of an occurrence of the specified value in a string in JavaScript?

With JavaScript, I want to retrieve the last index of the occurrence of the word “Learn” in the following string: , Which method should I use in JavaScript to achieve this?
Ayyan
Answered on 17th Jan, 2018

This method returns the index within the calling String object of the last occurrence of the specified value, starting the search at fromIndex or -1 if the value is not found. The following is the syntax:string.lastIndexOf(searchValue[, fromIndex])Here are the parameters:searchValue − A string representing the value to search for.fromIndex − The ... Read More

What are the properties of a boolean object in JavaScript?

I want to learn about the usage of the Boolean object. What properties does it support? An example stating the usage of the Boolean object would work great for me in understanding the concept o.....
Akshaya Akki
Answered on 17th Jan, 2018

The Boolean object represents two values, either "true" or "false". If value parameter is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), the object has an initial value of false.Here is a list of the properties of a Boolean object:Sr.NoProperty & Description1constructorReturns a reference ... Read More

How to check if a variable is boolean in JavaScript?

Let’s say I have the following variable declaration: , With JavaScript, how can I check if a variable is a Boolean or not?
Alankritha Ammu
Answered on 17th Jan, 2018

To check if a variable is Boolean in JavaScript, use the typeof operator. You can try to run the following code to check for a Boolean variable:ExampleLive Demo<html>    <head>       <title>JavaScript Boolean</title>    </head>    <body>       <script>          var answer ... Read More

What does the str() function do in Python Object Oriented Programming?

What does the str() function do in Python Object Oriented Programming?
Rajendra Dharmkar
Answered on 18th Jan, 2018

The __str__ method__str__ is a special method, like __init__, that returns a 'informal' string representation of an object. It is useful in debugging.Consider the following code that uses the __str__ methodclass Time:     def __str__(self):         return '%.2d:%.2d:%.2d' % (self.hour, self.minute, self.second)When we print an object, ... Read More

How to declare a boolean in JavaScript?

I am new to JavaScript and learning about the correct usage of the Boolean and Boolean object. How can I assign a true or false value to a variable in JavaScript? Which one should I use the fol.....
Ayyan
Answered on 17th Jan, 2018

To declare a Boolean in JavaScript, you need to assign true or false value.var answer = true;To learn about the working of Boolean, let’s see the following example:Live Demo<html>    <head>       <title>JavaScript Boolean</title>    </head>    <body>       <script>          var ... Read More

How to create a Boolean object in JavaScript?

Booleans have two values, true or false, but how to work with a Boolean object in JavaScript? I need an example that would explain me the concept of Booleans and what all values come under obje.....
Anjana
Answered on 17th Jan, 2018

The Boolean object represents two values, either "true" or "false". If the value parameter is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), the object has an initial value of false.Create a Boolean object like this:var val = new Boolean(value);You can try to run ... Read More

Advertisements
Loading...
Unanswered Questions View All

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.