向数组添加值 [英] adding values to an array

查看:84
本文介绍了向数组添加值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个数组,只需点击一个按钮即可为数组添加一个数字,这样我就可以将一系列数字发送到第二页。


我只是不确定怎么做???


从未使用数组

I am trying to write an array that adda a number to the array on the click of a button, this is so i can send a series of numbers to a second page.

im just not sure how to do it???

never used arrays

推荐答案

我不知道一个数组可以写一些东西到另一个数组......你可能意味着功能。您可以使用数组方法( Array?MDC ),例如
I''m not aware that an array can write something to another array..... you probably mean function. you can use an array method (Array ? MDC), e.g.
展开 | 选择 | Wrap | 行号


我需要的是包含一系列数字的数组


即123,234,345等


推送功能会这样做吗?


想法是数组保存我们网站上的东西的id,这样你就可以点击它们作为最喜欢的,然后从另一个页面查看所有收藏....有点像购物车
what i need is the array to contain a series of numbers

i.e 123,234,345 etc

will the push function do this?

The idea is that the array holds the id for things on our site so you can click them as a favorite and then view all favorites from another page....a bit like a shopping cart


让我解释一下push()方法:
let me explain the push() method:
展开 | 选择 | Wrap | 行号


这篇关于向数组添加值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆