Files
.github
api-server
client
config
curriculum
challenges
_meta
arabic
chinese
01-responsive-web-design
02-javascript-algorithms-and-data-structures
basic-algorithm-scripting
basic-data-structures
basic-javascript
access-array-data-with-indexes.chinese.md
access-multi-dimensional-arrays-with-indexes.chinese.md
accessing-nested-arrays.chinese.md
accessing-nested-objects.chinese.md
accessing-object-properties-with-bracket-notation.chinese.md
accessing-object-properties-with-dot-notation.chinese.md
accessing-object-properties-with-variables.chinese.md
add-new-properties-to-a-javascript-object.chinese.md
add-two-numbers-with-javascript.chinese.md
adding-a-default-option-in-switch-statements.chinese.md
appending-variables-to-strings.chinese.md
assignment-with-a-returned-value.chinese.md
build-javascript-objects.chinese.md
chaining-if-else-statements.chinese.md
comment-your-javascript-code.chinese.md
comparison-with-the-equality-operator.chinese.md
comparison-with-the-greater-than-operator.chinese.md
comparison-with-the-greater-than-or-equal-to-operator.chinese.md
comparison-with-the-inequality-operator.chinese.md
comparison-with-the-less-than-operator.chinese.md
comparison-with-the-less-than-or-equal-to-operator.chinese.md
comparison-with-the-strict-equality-operator.chinese.md
comparison-with-the-strict-inequality-operator.chinese.md
comparisons-with-the-logical-and-operator.chinese.md
comparisons-with-the-logical-or-operator.chinese.md
compound-assignment-with-augmented-addition.chinese.md
compound-assignment-with-augmented-division.chinese.md
compound-assignment-with-augmented-multiplication.chinese.md
compound-assignment-with-augmented-subtraction.chinese.md
concatenating-strings-with-plus-operator.chinese.md
concatenating-strings-with-the-plus-equals-operator.chinese.md
constructing-strings-with-variables.chinese.md
count-backwards-with-a-for-loop.chinese.md
counting-cards.chinese.md
create-decimal-numbers-with-javascript.chinese.md
declare-javascript-variables.chinese.md
declare-string-variables.chinese.md
decrement-a-number-with-javascript.chinese.md
delete-properties-from-a-javascript-object.chinese.md
divide-one-decimal-by-another-with-javascript.chinese.md
divide-one-number-by-another-with-javascript.chinese.md
escape-sequences-in-strings.chinese.md
escaping-literal-quotes-in-strings.chinese.md
find-the-length-of-a-string.chinese.md
finding-a-remainder-in-javascript.chinese.md
generate-random-fractions-with-javascript.chinese.md
generate-random-whole-numbers-with-javascript.chinese.md
generate-random-whole-numbers-within-a-range.chinese.md
global-scope-and-functions.chinese.md
global-vs.-local-scope-in-functions.chinese.md
golf-code.chinese.md
increment-a-number-with-javascript.chinese.md
initializing-variables-with-the-assignment-operator.chinese.md
introducing-else-if-statements.chinese.md
introducing-else-statements.chinese.md
iterate-odd-numbers-with-a-for-loop.chinese.md
iterate-through-an-array-with-a-for-loop.chinese.md
iterate-with-javascript-do...while-loops.chinese.md
iterate-with-javascript-for-loops.chinese.md
iterate-with-javascript-while-loops.chinese.md
local-scope-and-functions.chinese.md
logical-order-in-if-else-statements.chinese.md
manipulate-arrays-with-pop.chinese.md
manipulate-arrays-with-push.chinese.md
manipulate-arrays-with-shift.chinese.md
manipulate-arrays-with-unshift.chinese.md
manipulating-complex-objects.chinese.md
modify-array-data-with-indexes.chinese.md
multiple-identical-options-in-switch-statements.chinese.md
multiply-two-decimals-with-javascript.chinese.md
multiply-two-numbers-with-javascript.chinese.md
nest-one-array-within-another-array.chinese.md
nesting-for-loops.chinese.md
passing-values-to-functions-with-arguments.chinese.md
practice-comparing-different-values.chinese.md
profile-lookup.chinese.md
quoting-strings-with-single-quotes.chinese.md
record-collection.chinese.md
replacing-if-else-chains-with-switch.chinese.md
return-a-value-from-a-function-with-return.chinese.md
return-early-pattern-for-functions.chinese.md
returning-boolean-values-from-functions.chinese.md
selecting-from-many-options-with-switch-statements.chinese.md
shopping-list.chinese.md
stand-in-line.chinese.md
store-multiple-values-in-one-variable-using-javascript-arrays.chinese.md
storing-values-with-the-assignment-operator.chinese.md
subtract-one-number-from-another-with-javascript.chinese.md
testing-objects-for-properties.chinese.md
understand-string-immutability.chinese.md
understanding-boolean-values.chinese.md
understanding-case-sensitivity-in-variables.chinese.md
understanding-undefined-value-returned-from-a-function.chinese.md
understanding-uninitialized-variables.chinese.md
updating-object-properties.chinese.md
use-bracket-notation-to-find-the-first-character-in-a-string.chinese.md
use-bracket-notation-to-find-the-last-character-in-a-string.chinese.md
use-bracket-notation-to-find-the-nth-character-in-a-string.chinese.md
use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.chinese.md
use-conditional-logic-with-if-statements.chinese.md
use-multiple-conditional-ternary-operators.chinese.md
use-the-conditional-ternary-operator.chinese.md
use-the-parseint-function-with-a-radix.chinese.md
use-the-parseint-function.chinese.md
using-objects-for-lookups.chinese.md
word-blanks.chinese.md
write-reusable-javascript-with-functions.chinese.md
debugging
es6
functional-programming
intermediate-algorithm-scripting
javascript-algorithms-and-data-structures-projects
object-oriented-programming
regular-expressions
03-front-end-libraries
04-data-visualization
05-apis-and-microservices
06-information-security-and-quality-assurance
08-coding-interview-prep
09-certificates
english
portuguese
russian
spanish
schema
test
.babelrc
.editorconfig
.npmignore
.travis.yml
CHANGELOG.md
LICENSE.md
commitizen.config.js
commitlint.config.js
create-challenge-bundle.js
getChallenges.js
gulpfile.js
index.js
lib.js
md-translation.js
package-entry.js
package-lock.json
package.json
utils.js
cypress
docs
search-indexing
tools
utils
.editorconfig
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
.gitpod.yml
.node-inspectorrc
.npmrc
.prettierignore
.prettierrc
.snyk
.travis.yml
.vcmrc
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile.tests
HoF.md
LICENSE.md
README.md
SECURITY.md
change_volumes_owner.sh
cypress-install.js
cypress.json
docker-compose-shared.yml
docker-compose.tests.yml
docker-compose.yml
jest.config.js
lerna.json
package-lock.json
package.json
sample.env
freeCodeCamp/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.chinese.md
Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite ()
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

66 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 56bbb991ad1ed5201cd392cb
title: Manipulate Arrays With push()
challengeType: 1
videoUrl: ''
localeTitle: 用push操纵数组
---
## Description
<section id="description">将数据附加到数组末尾的简单方法是通过<code>push()</code>函数。 <code>.push()</code>接受一个或多个<dfn>参数</dfn>并将它们“推”到数组的末尾。 <blockquote> var arr = [1,2,3]; <br> arr.push4; <br> // arr现在是[1,2,3,4] </blockquote></section>
## Instructions
<section id="instructions"><code>[&quot;dog&quot;, 3]</code>推到<code>myArray</code>变量的末尾。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>myArray</code>现在应该等于<code>[[&quot;John&quot;, 23], [&quot;cat&quot;, 2], [&quot;dog&quot;, 3]]</code> 。'
testString: assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] === 23 && d[2][0] == 'dog' && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray));
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
// Example
var ourArray = ["Stimpson", "J", "cat"];
ourArray.push(["happy", "joy"]);
// ourArray now equals ["Stimpson", "J", "cat", ["happy", "joy"]]
// Setup
var myArray = [["John", 23], ["cat", 2]];
// Only change code below this line.
```
</div>
### After Test
<div id='js-teardown'>
```js
console.info('after the test');
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>