Espruino/tests/test_arrays_treated_as_references_in_functions.js
Michael Duerinckx 7f5308590b Rename numbered tests to something more descriptive - closes #16
test077 is the only one I really couldn't figure out what it was meant
to test.
2014-03-01 22:15:28 +00:00

19 lines
194 B
JavaScript

// references with functions
var a = 42;
var b = [];
b[0] = 43;
function foo(myarray) {
myarray[0]++;
}
function bar(myvalue) {
myvalue++;
}
foo(b);
bar(a);
result = a==42 && b[0]==44;