0
I’m running a JS code using Sublime Text, cmd automatically closes after executing the JS code, so I don’t see the results so I thought I’d use something similar to the system("pause") function or the getch() function of C/C++ there’s also the Readkey() of C#.
A few basic examples of what I look for in Javascript in other languages:
C#
using System;
class Exe{
static void Main(){
// Apesar de Não estar no Padrão .NET o Código funciona Perfeitamente
Console.Write("Olá Mundo!\nPressione Qualquer tecla para Encerrar a Execução do Programa...");
Console.ReadKey();
}
}
Python 3
print('Olá Mundo!\nPressione Enter para Encerrar a Execução do Programa...', end='')
sysPause = str(input('')) # Precisa pressionar Enter, diferente dos Outros exemplos...
C
#include <stdio.h>
#include <stdlib.h>
int main(){
printf("Olá Mundo!\n");
system("pause");
return 0;
}
C++
#include <iostream>
#include <conio.h>
using namespace std;
int main(){
cout << "Olá Mundo!\nPressione Qualquer tecla para Encerrar a Execução do Programa...";
getch(); // ou getche()
return 0;
}
helped same guy worth, in the case of sublime created 2 build for JS, one that only runs the command "Node", "$file_name" and runs the JS code on the sublime console (which does not work to read keyboard data, even in python, java but displays all prints defined, so I see the results, what you said, does not accept user input), and the "start", "Node", "$file_name" that runs the script in Windows cmd, but after code execution cmd is automatically closed by OS.
– Luciano Filho
thanks again
– Luciano Filho