Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use javascript function to write a bank to withdraw money and deposit money

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to use the javascript function to compile the bank to withdraw money and deposit". In the daily operation, I believe that many people have doubts about how to use the javascript function to prepare the bank to withdraw money and deposit money. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful for everyone to answer the question of "how to use the javascript function to prepare a bank to withdraw money and deposit". Next, please follow the editor to study!

The specific code is as follows:

Const readline = require ('readline-sync') / / reference readline-synclet arr = [[' zhang', '123, 2000], [' yang', '12345, 3000]]; / / Log in let add = function () {let s = 2 while (true) {console.log (' Please enter user name:'); let user = readline.question (); console.log ('Please enter password:') Let password = readline.question (); for (let I = 0; I

< arr.length; i++) { if (user === arr[i][0] && password === arr[i][1]) { console.log('欢迎你,登陆成功'); mean(i); return; } } //输入不正确,超过三次 if (s != 0) { console.log(`密码或账户有误,你还有${s}次机会,请重新输入!`); s--; } else { console.log('对不起,账户锁定!'); break; } }}//存款let fn1 = function (i) { console.log('存款'); console.log('请输入存款金额:'); let cunkuan = readline.question() - 0; arr[i][2]+= cunkuan; console.log('系统正在为你存钱请稍等。。。。。\n存钱成功您当前余额为' + arr[i][2]);}//取款let fn2 = function (i) { console.log('取款'); console.log('请输入取款金额:'); let qukuan = readline.question() - 0; if (qukuan >

Arr [I] [2]) {console.log ('sorry you don't have enough balance! , please re-enter the amount or exit');} else {arr [I] [2] = arr [I] [2]-qukuan; console.log ('is withdrawing money for you. \ nyour current balance is:'+ arr [I] [2]);}} / / View let fn3 = function (I) {console.log ('View'); console.log ('querying. \ nyour current balance is:'+ arr [I] [2]);} / / exit let fn4 = function () {console.log ('exit'); console.log ('Welcome to use it next time!') ;} / / process let mean = function (I) {for (let yewu = 1; yewu > = 1; yewu++) {console.log ('Please select business:\ N1. Deposit:\ n2. Withdrawal:\ n3. View:\ n4. Exit:'); let yewu = readline.question ()-0; switch (yewu) {case 1: fn1 (I); continue; case 2: fn2 (I); continue; case 3: fn3 (I); continue; case 4: fn4 (); return;} break;}} add () At this point, the study on "how to use the javascript function to write a bank to withdraw money and deposit money" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report