Push in an array the value of Event


#1

I have this event

var selected = new Array();

 'change [type=checkbox]': function(event, template){
            console.log("id of checkbox: " + event.target.id);
            console.log("value of checkbox: " + event.target.value);
            selected.push(event.target.value);
                if(selected && selected.length){   
                    foo.values = Number(selected); //feeding a module that expects a proper Array.
                } else {
                    console.log('not an array');
                };
        }

in which I am getting the values when a checkbox is on from my HTML

<template name="ipsosboard">
    <p align="left">
        <ul>
            {{#each dataItems}}
            <li> pt: {{pt}} <input id="pt" name="pt" value={{pt}} type="checkbox"></li>
            <li> eta: {{eta}} <input id="eta" value={{eta}} type="checkbox"></li>
            <li> phi: {{phi}} <input id="phi" value={{phi}} type="checkbox"></li>
            <li> charge: {{charge}} <input id="charge" value={{charge}} type="checkbox"></li>
        {{/each}}
    </ul>
    </p>

The desired output of this is that I would like to get the values of each checkbox when is on and push this values to an array and use it to another module. Although it works I am not sure I get exactly what I want as I see the array contains strings instead of numbers, thus I use a Number(); but still I am not exactly convinced my code is safe and clean.