// withdraw function withdraw(balance,n){ // initialize balance to zero balance = 2000; if(n < balance){ balance = balance - n ; } else if(n > balance){ alert("INSUFFICIENT FUNDS"); } else{ confirm('are you sure you would like to withdraw all you funds from this account?'); balance = null } console.log(balance); }; withdraw(2000,1900); function deposit(balance,n){ balance = 0; if (n != 0 ){ balance = balance + n ; } else{ alert('please enter a valid deposit'); } console.log(balance); } deposit(0,100)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter