F
F
fandorin_official2018-02-08 16:26:08
JavaScript
fandorin_official, 2018-02-08 16:26:08

How to get an element from an array?

All good.
Please tell me how to get the element "123" from the array:

var mass= [
        {input: [0], output: [1]}, //1
        {input: [1], output: [1]}, //2
        {input: [123], output: [0]}, //3
        {input: [0], output: [1]}, //4
        {input: [0], output: [1]}, //5
        {input: [0], output: [1]}, //6
        {input: [0], output: [1]}, //7
        {input: [0], output: [1]}, //8
        {input: [0], output: [1]}, //9
        {input: [0], output: [1]} //10
    ];

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lodas, 2018-02-08
@lodas

console.log("mass", mass[2].input[0]);

V
VoidVolker, 2018-02-08
@VoidVolker

If there is a search task, then for example:

console.log( mass.find(function(item){ return item.input[0] == 123; }) );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question