Giter Site home page Giter Site logo

ahamedali95 / ssp19testbuilder Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 17 KB

Given a credit card number, the program detects the name of the credit card network, like 'MasterCard' or 'American Express'

JavaScript 95.64% HTML 4.36%
mastercard visa card-network switch

ssp19testbuilder's Introduction

ssp19TestBuilder

Given a credit card number, this function should return a string with the name of a network, like 'MasterCard' or 'American Express' Example: detectNetwork('343456789012345') should return 'American Express'

How can you tell one card network from another? Easy! There are two indicators:

  1. The first few numbers (called the prefix)
  2. The number of digits in the number (called the length)

Note: cardNumber will always be a string

1.The Diner's Club network always starts with a 38 or 39 and is 14 digits long

2.The American Express network always starts with a 34 or 37 and is 15 digits long

3.Visa always has a prefix of 4 and a length of 13, 16, or 19.

4.MasterCard always has a prefix of 51, 52, 53, 54, or 55 and a length of 16

5.Discover always has a prefix of 6011, 644-649, or 65, and a length of 16 or 19.

6.Maestro always has a prefix of 5018, 5020, 5038, or 6304, and a length of 12-19.

7.China UnionPay always has a prefix of 622126-622925, 624-626, or 6282-6288 and a length of 16-19.

8.Switch always has a prefix of 4903, 4905, 4911, 4936, 564182, 633110, 6333, or 6759 and a length of 16, 18, or 19.

Heads up! Switch and Visa seem to have some overlapping card numbers - in any apparent conflict, you should choose the network with the longer prefix.

ssp19testbuilder's People

Contributors

ahamedali95 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.