Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a javascript function called regCheck that can check if a registration number is for GP, L, EC, MP registration plates. It takes two parameters
Write a javascript function called regCheck that can check if a registration number is for GP, L, EC, MP registration plates. It takes two parameters and return a boolean. The function should return true for registration numbers like this:
RG 45 HN GP
LKG 679 EC
GHT 456 MP
FGT 491 L
The function should return false for registration numbers like this:
ND 123-456
CY 678-453
CA 1234-123
var isGP = regCheck('DV 23 NB GP', 'GP'); // should print true console. log( isGP); var isMP = regCheck('DV 23 LP GP', 'MP'); // should print false console. log( isMP); // should return false var isBellville = regCheck('CY 189-012', 'CY'); // should return false var isDurban = regCheck('CY 189-012', 'ND')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started