I have the file default.json:
{
"IPs": {
"ip1": "192.168.0.1",
"ip2": "192.168.0.2",
"ip3": "192.168.0.3"
}
}
My code:
var _ = require('underscore'),
config = require('default.json')
var array = ['192.168.0.1', '192.168.0.2']
//search array in IPs
How can I search values of array in IPs (ip1, ip2, ip3) and whenever it's true, call a function? Preferably using an underscore function.
"ip1": "192.168.0.1"instead of"ip1: 192.168.0.1"? (note the quotes).,after each line of the JSON file.default.jsonis still invalid unless you remove the"IPs":part, or add surrounding{}.