0

What does the string command mean? And how is it related to boolean?

What does the string command mean? And how is it related to boolean? I started learning Javascript. At the end of the second training module there was a question for which I could not find a logical explanation. My knowledge of previous lessons is not enough to answer correctly. I used the tips, but there is no understanding. Help! If possible, explain how these types are related.

9th Oct 2018, 1:58 PM
Maren
Maren - avatar
4 Answers
+ 3
They want the datatype of the variable. A variable can have different datatypes, it can be an integer(a whole number) or a string("multiple characters") You should learn something about datatypes. In other languages like java you have to explicitly instantiate a variable of type string as: String varName = ""; and an integer(number) would be: int varName = 0; but in javascript you can just say var varName = someThing. Javascript will detect the dataType for you. So learn datatypes. They are used in all the programming languages. its a basic thing you need to understand :)
9th Oct 2018, 2:49 PM
Willem Roos
+ 2
A String is a datatype. so if you make a variable in javascript and set it to a string, ie: var testString = "This is a string"; If a variable is a string you can call the String methods on it. like: testString.length; testString.indexOf("is"'); https://www.w3schools.com/js/js_string_methods.asp I dont see how its related to boolean..
9th Oct 2018, 2:13 PM
Willem Roos
0
Here is an example of a question that I had to answer. Please type in the comments for the data listed below: 12//number "some text" //_____ true//_______ The correct answer was to introduce: string boolean What is the connection between this?
9th Oct 2018, 2:30 PM
Maren
Maren - avatar
0
Many thanks for the full and complete answer.
9th Oct 2018, 2:58 PM
Maren
Maren - avatar