The JavaScript string is split into a single character addition and no more than 10 to find the final value 1th/2 page _javascript tips

Source: Internet
Author: User
First, list your birthdays, like 1987 12 25.
And then the addition of a bit 1+9+8+7+1+2+2+5=35
We'll split the numbers and add 3+5=8.
The number 8 is the final result, if more than 10 of the words are split and then add
1 kidney
2 eyes
3 Talent Talent
4 Benign genes
5 Friendship
6 The Heart of charity
7 Affection
8 Health and life expectancy
9 Love
10 Congratulations, you have a pure soul, best for pawn.
Examples of Cloeft
<script type= "Text/javascript" > var str = "19871229"; var count = 0; for (var i = 0; i < str.length i++) Count + = parseint (Str.charat (i)); Alert (GetResult (count)); function GetResult (x) {var a = Math.floor (X/10); var B = x%10; if (A+b >) return GetResult (A+B); else return (A+B); } </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

example of a handsome frog
<script> var birthday = "1982512"; Birthsum (birthday); function Birthsum (str) {var bsum = 0; var arr = str.tostring (). Split ("); for (var i = 0; i<arr.length; i++) {bsum + = parseint (Arr[i]); } if (Bsum >) {birthsum (bsum); }else{alert (bsum); }} </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Examples of Ariex
<script type= "Text/javascript" > var num= "11111232"; var sum=0; while (true) {for (Var i=0;i<num.length;i++) {Sum+=parseint (Num.charat (i)); } if (sum<11) break; else{num=sum+ ""; sum=0; } alert (sum); </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Current 1/2 page 12 Next read the full text
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.