I am new to JavaScript and still learning, so please bear with me.
I have a unique task of creating multiple voucher codes, each with a specific redeemable amount. When a user purchases a voucher and enters the code in a text field, I need JavaScript to validate the code, confirm the amount redeemed, and display it - similar to how Amazon gift cards work!
All this needs to be implemented in a simple HTML page that I have set up.
As I am just beginning with JS, I have been struggling to figure this out on my own.
For instance, I have several voucher codes stored as strings:
var voucher1 = 'AC60';
var voucher2= 'DC60';
var voucher3= 'RC60';
var voucher4= 'XC60';
var voucher5= 'YC60';
var voucher6= 'WC60';
var voucher7= 'ZC60';
How can I assign a monetary value to each code, validate a user's input, confirm the redeemed amount, and display it, mimicking the process of redeeming Amazon gift cards?