68 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						||
title: Iterated digits squaring
 | 
						||
id: 5a23c84252665b21eecc7ec1
 | 
						||
challengeType: 5
 | 
						||
videoUrl: ''
 | 
						||
localeTitle: 迭代的数字平方
 | 
						||
---
 | 
						||
 | 
						||
## Description
 | 
						||
<section id="description">如果添加自然数(大于零的整数)的数字的平方,则始终以1或89结尾: <pre> 15  - > 26  - > 40  - > 16  - > 37  - > 58  - > 89
 | 
						||
7  - > 49  - > 97  - > 130  - > 10  - > 1 </pre>编写一个函数,该函数将数字作为参数,并在执行上述过程后返回1或89。 </section>
 | 
						||
 | 
						||
## Instructions
 | 
						||
<section id="instructions">
 | 
						||
</section>
 | 
						||
 | 
						||
## Tests
 | 
						||
<section id='tests'>
 | 
						||
 | 
						||
```yml
 | 
						||
tests:
 | 
						||
  - text: <code>iteratedSquare</code>应该是一个函数。
 | 
						||
    testString: 'assert(typeof iteratedSquare=="function","<code>iteratedSquare</code> should be a function.");'
 | 
						||
  - text: <code>iteratedSquare(4)</code>应该返回一个数字。
 | 
						||
    testString: 'assert(typeof iteratedSquare(4)=="number","<code>iteratedSquare(4)</code> should return a number.");'
 | 
						||
  - text: <code>iteratedSquare(4)</code>应该返回<code>89</code> 。
 | 
						||
    testString: 'assert.equal(iteratedSquare(4),89,"<code>iteratedSquare(4)</code> should return <code>89</code>.");'
 | 
						||
  - text: <code>iteratedSquare(7)</code>应该返回<code>1</code> 。
 | 
						||
    testString: 'assert.equal(iteratedSquare(7),1,"<code>iteratedSquare(7)</code> should return <code>1</code>.");'
 | 
						||
  - text: <code>iteratedSquare(15)</code>应该返回<code>89</code> 。
 | 
						||
    testString: 'assert.equal(iteratedSquare(15),89,"<code>iteratedSquare(15)</code> should return <code>89</code>.");'
 | 
						||
  - text: <code>iteratedSquare(20)</code>应该返回<code>89</code> 。
 | 
						||
    testString: 'assert.equal(iteratedSquare(20),89,"<code>iteratedSquare(20)</code> should return <code>89</code>.");'
 | 
						||
  - text: <code>iteratedSquare(70)</code>应该返回<code>1</code> 。
 | 
						||
    testString: 'assert.equal(iteratedSquare(70),1,"<code>iteratedSquare(70)</code> should return <code>1</code>.");'
 | 
						||
  - text: <code>iteratedSquare(100)</code>应该返回<code>1</code> 。
 | 
						||
    testString: 'assert.equal(iteratedSquare(100),1,"<code>iteratedSquare(100)</code> should return <code>1</code>.");'
 | 
						||
 | 
						||
```
 | 
						||
 | 
						||
</section>
 | 
						||
 | 
						||
## Challenge Seed
 | 
						||
<section id='challengeSeed'>
 | 
						||
 | 
						||
<div id='js-seed'>
 | 
						||
 | 
						||
```js
 | 
						||
function iteratedSquare (n) {
 | 
						||
  // Good luck!
 | 
						||
}
 | 
						||
 | 
						||
```
 | 
						||
 | 
						||
</div>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
</section>
 | 
						||
 | 
						||
## Solution
 | 
						||
<section id='solution'>
 | 
						||
 | 
						||
```js
 | 
						||
// solution required
 | 
						||
```
 | 
						||
</section>
 |