How to Use String Length using Node Js?
Jan 22, 2022 . Admin

Hello Friends,
Now let's see example of how to use string length example. We will check how to use string length. This is a short guide on use string length in node js. Let's get started with how to use string length in node js.
Here i will give you many example how to use string length using node js.
Example 1 :
Run following command to create node app.
mkdir my-app cd my-app npm initStep 2 : Create server.js file
server.js
const str = 'MyWebtuts Tutorial:'; console.log(`${str} ${str.length}`);
now you can simply run by following command:
node server.jsOutput :
MyWebtuts Tutorial: 19
Example 2 :
Step 1 : Create Node AppRun following command to create node app.
mkdir my-app cd my-app npm initStep 2 : Create server.js file
server.js
let str = "MyWebtuts Tutorial String Length"; let strLength = str.strLength; console.log(strLength);
now you can simply run by following command:
node server.jsOutput :
32
It will help you...