This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
//read, write and delete file using sync methodss. | |
const fs = require('fs'); | |
const data = fs.readFileSync('target.txt'); | |
fs.writeFileSync("turbo.txt", `I am from target.txt: ${data} this is take 2`); | |
process.stdout.write("\nFrom process stdout: " + data.toString()); | |
console.log("\nFrom console log: " + data.toString()) | |
const targetTxt = fs.readFileSync('turbo.txt'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***note that .split will turn a string of numbers into an array ***/ | |
//let a = '1,2,3,4,5' | |
//a.split(',') | |
/**********take numbers in an array and convert to string.**********/ | |
var numbers = [1,2,3,4,5,6] | |
let toString = numbers.map(String); | |
console.log(toString) | |
/*********take numbers in a string and convert into an array*******/ | |
//var numbers = ['1','2','3','4','5'] |