convert input to string javascript code example
Example 1: turn object into string javascript
var obj = {a: "a", b: "b" /*...*/};
var string = JSON.stringify(obj);
// OUTPUT:
// "{'a':'a', 'b':'b'}"
Example 2: javascript to string
num.toString();
Example 3: how to turn number into string javascript
var myNumber=120;
var myString = myNumber.toString(); //converts number to string "120"
Example 4: javascript store text file into string
var fs = require("fs");
fs.readFile("./mytext.txt", function(text){
var textByLine = text.split("\n")
});