JavaScript New Student Information

Source: Internet
Author: User

functionAdd (user1, length) {Let status=true;//Status ValueConsole.log ("Please enter new student name:"); Let name=readline.question (); Let REG1=/[a-za-z]/;//use regular expressions to ensure that student names are entered correctly     while(!reg1.test (name)) {Console.log ("Student name must not contain numbers and illegal characters, please re-lose"); Name=readline.question (); } console.log ("Please enter new Student Age:"); let Age= Readline.question ()-0;  while(IsNaN (age) | | < 1) {//guaranteed output Correct ageConsole.log ("Please re-lose"); Age= Readline.question ()-0; } console.log ("Please enter new Student gender:"); Let gender=readline.question (); Console.log ("Please enter new Student scores:"); Let score= Readline.question ()-0;  while(IsNaN (score) | | Score < 0 | | score > 100) {//guaranteed output Correct resultsConsole.log ("Please re-lose"); Score= Readline.question ()-0; } console.log ("New success!" The student information is as follows: "); Length++; User1.push ({id:length, name, age, gender, score}) Console.log (User1[length -1]);} Add (user1, user1.length);//calling Functions

JavaScript New Student Information

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.