JavaScript-code implementation in Koshien

Source: Internet
Author: User
$tianGan = Array (' A ', ' B ', ' C ', ' ding ', ' e ', ' self ', ' Geng ', ' xin ', ' ren ', ' decyl ');
$diZhi = Array (' child ', ' ugly ', ' Yin ', ' Mao ', ' Chen ', ' have ', ' noon ', ' not ', ' shen ', ' unitary ', ' Xu ', ' Hai ');
How to output the following results:
$GZ = Array (

       '甲子','乙丑','丙寅','丁卯','戊辰','已巳','庚午','辛未','壬申','癸酉',       '甲戌','乙亥','丙子','丁丑','戊寅','已卯','庚辰','辛巳','壬午','癸未',       '甲申','乙酉','丙戌','丁亥','戊子','己丑','庚寅','辛卯','壬辰','癸巳',       '甲午','乙未','丙申','丁酉','戊戌','已亥','庚子','辛丑','壬寅','癸卯',       '甲辰','乙巳','丙午','丁未','戊申','已酉','庚戌','辛亥','壬子','癸丑',       '甲寅','乙卯','丙辰','丁巳','戊午','已未','庚申','辛酉','壬戌','癸亥'

);
is the so-called 60 koshien.

Reply content:

$tianGan = Array (' A ', ' B ', ' C ', ' ding ', ' e ', ' self ', ' Geng ', ' xin ', ' ren ', ' decyl ');
$diZhi = Array (' child ', ' ugly ', ' Yin ', ' Mao ', ' Chen ', ' have ', ' noon ', ' not ', ' shen ', ' unitary ', ' Xu ', ' Hai ');
How to output the following results:
$GZ = Array (

       '甲子','乙丑','丙寅','丁卯','戊辰','已巳','庚午','辛未','壬申','癸酉',       '甲戌','乙亥','丙子','丁丑','戊寅','已卯','庚辰','辛巳','壬午','癸未',       '甲申','乙酉','丙戌','丁亥','戊子','己丑','庚寅','辛卯','壬辰','癸巳',       '甲午','乙未','丙申','丁酉','戊戌','已亥','庚子','辛丑','壬寅','癸卯',       '甲辰','乙巳','丙午','丁未','戊申','已酉','庚戌','辛亥','壬子','癸丑',       '甲寅','乙卯','丙辰','丁巳','戊午','已未','庚申','辛酉','壬戌','癸亥'

);
is the so-called 60 koshien.

 var tianGan = ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'],                diZhi = ['子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥'],                tianGanLength = tianGan.length,                dizhiLength = diZhi.length,                i = 0, j = 0,                result = [];        while (1) {            var x = i % tianGanLength,                    y = j % dizhiLength;            if (x == 0 && y == 0 && i) {                break;            }            result.push(tianGan[x] + diZhi[y]);            i++;            j++;        }

The code is out of the way. The general method is to observe the law first of all, if obscure so inconvenient to see can be converted into a number of observations of the law This example is actually ten zodiac overall cycle six times that total 60 times each zodiac count and the earthly +1 judgment exceeds the respective totals back to the first Basically, this is the way to write.

  • 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.