console.log() is the same of process.stdout.write(msg + '/n')If you use on index.js:
console.log(process.argv)| //npx create-react-app my-app --template typescript | |
| import {useState, useEffect} from 'react' | |
| interface ITodo { | |
| userId: number; | |
| id: string; | |
| title: string; | |
| } |
| import './App.css'; | |
| import {useState} from 'react'; | |
| function App() { | |
| const [count, setCount] = useState({count: 0, theme: 'light'}) | |
| //const [count, setCount] = useState(0) | |
| //const [theme, setTheme] = useState("dark") | |
| const incrementCount = () => { | |
| setCount((prevState) => { |
| for (var i = 0; i < 9; i++) { | |
| console.log(i); | |
| // more statements | |
| } |
| const args = process.argv.slice(2) | |
| console.log(`Hello ${args[0]} your secret ${args[1]} is correct`) |
| useState(); |
| import chaiAsPromised from 'chai-as-promised'; | |
| import * as chai from 'chai' | |
| import sinon from 'sinon' | |
| import Book from '../../src/entities/Book'; | |
| import BookService from '../../src/Services/BookService'; | |
| import { Model } from 'mongoose'; | |
| chai.use(chaiAsPromised) | |
| const expect = chai.expect |
| function* simple() { | |
| yield 1 | |
| yield 2 | |
| yield 3 | |
| } | |
| let a = simple() | |
| console.log(a.next()) | |
| console.log(a.next()) | |
| console.log(a.next()) |
| import fetch from 'node-fetch' | |
| import fs from 'fs' | |
| const groupArray = (arr) => { | |
| let map = new Map() | |
| for (let i = 0; i < arr.length; i++) { | |
| const s = JSON.stringify(arr[i].team1); | |
| if (!map.has(s)) { | |
| map.set(s, { | |
| team: arr[i].team1, |
| function diagonalDifference(arr) { | |
| let principalDiagonal = 0 | |
| let secondaryDiagonal = 0 | |
| for (let i = 0; i < arr.length; i++) { | |
| for (let j = 0; j < arr.length; j++) { | |
| if (i == j) { | |
| principalDiagonal += arr[i][j] | |
| } | |
| } | |
| } |