如何在节点js中创build相同值的下一个条件
我的代码有问题
价值在我的JSON
[ { "title": "a", "detail": { "descript": "test" } }, { "title": "b", "detail": { "descript": "test1" } }, { "title": "c", "detail": { "descript": "test2" } } ]
我的模型API
router.post('/newscreate', function(req, res){ var queryng = req.body || req.body.query; if (queryng){ for (i=0; i<queryng.length; i++){ var loop = queryng[i]; if (loop){ if (loop.title != 'a'){ console.log('true', loop.title); }else{ console.log('false', loop.title); //event if value same 'a' then post title b and title c } } } } });
我有一天累了只是为了做这个条件,谁能帮助纠正这个代码? 谢谢