PS C:\Users\gui20\OneDrive\Área de Trabalho\Banco JS> node .\Index.js
(node:25812) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ...
to show where the warning was created)
C:\Users\gui20\OneDrive\Área de Trabalho\Banco JS\Index.js:1
import { cliente } from "./Cliente.js";
^^^^^^
SyntaxError: Cannot use import statement outside a module at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1031:15) at Module.compile (node:internal/modules/cjs/loader:1065:27) at Object.Module.extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module.load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/runmain:81:12) at node:internal/main/run_main_module:17:47
classe cliente:
export class cliente{ nome; cpf; }
classe contaCorrente:
export class contaCorrente{ agencia; numero; _saldo; cliente;
Sacar(valor){
if(this._saldo >= valor){
this._saldo -= valor;
return valor;
}
}
Depositar(valor){
if(valor >0){
this._saldo += valor;
return "Saldo Atual: " + saldo;
}
}
}
package.JSON
{ "name": "bytebank", "version": "1.0.0", "description": "", "main": "Index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "Guilherme pontes", "license": "ISC" }