![]() The following table lists a different type of string function available in node.js. Same as JavaScript, in node.js we have a different type of string functions are available to manipulate any string based on our requirements. When we execute the above example, we will get the result as shown below. Here, we concatenated a strings by using + operator and concat string function. If you observe example, we defined a variables and assigned a string values using single and double quotes. ![]() In case, if the variable value is null, that means we assigned a null value to the variable instead of actual value.įollowing is the example of defining variables with or without values in node.js.Ĭonsole.log( "Concat Using (+) :", (x + ' ' + y)) Ĭonsole.log( "Concat Using Function :", (x.concat(y))) If the variable value is undefined, that means no value has been assigned to the variable. Here, we need to remember that undefined and null both are different. Instead, if we assign a null value to the variable, then the value of the variable becomes null. Same as JavaScript, in node.js also if we define a variable without assigning any value, then that will take undefined as value.Īs discussed, if we define a variable without a value, then that variable value will be undefined. In JavaScript, if we declare a variable without assigning any value, then automatically the undefined value assigned to that variable. This is how we can use Boolean data types in node.js along with conditional statements based on our requirements. ![]() When we navigate and execute the DataTypes.js file in the command prompt, we will get the result as shown below. If you observe above example, we created a variable called i by assigning a Boolean value ( true) and we are performing some other Boolean operations. ![]()
0 Comments
Leave a Reply. |