将两个变量添加到包含数组的一个变量中

时间:2016-03-09 09:12:26

标签: javascript variables

我想在下面的函数中使用“part1.length”,将变量“value”和“part”添加到一个名为“partvalue”的变量中,该变量应包含“part1”,因此我可以显示该变量的长度数组并在其他函数中使用它。当我向'value'添加'1'时,javascript应该使用数组'part2'。

var part1 = {'Hallo','test'}
var part2 = {'Hallo2','test2'}


var value = 1;
var part = 'part'
var partValue = part + value;

var dosomething = function(){
if(anotherValue < partValue.length){..... // Javascript should work with "part1.length" there, but it doesn't. What am I doing wrong. I didn't know what to search for on the internet, because I am very new here.

0 个答案:

没有答案