Is this each () method available in either of these two methods? How do you understand the following code?

first of all: non-set answer, really a little no, really a little do not understand, solve!

function getMatchedData(data,match){
            var result = data;
            var attrs = _______;
            attrs.each(function(obj){
                result = typeof result == "object" && result.hasOwnProperty(obj) ? _____ : ______;
            });
            result = typeof result == "undefind" ? "" : result;
            return result;
        }

        function templateDataMapping(temp,data){
            if(temp){
                var matches = temp.match(/{{[a-z_A-Z](\w+)?([\.][a-z_A-Z](\w+)?)*}}/g);
                matches.each(function(index,match){
                    temp = temp.replace(match,getMatchedData(data,match.substring(2,match.length-2)));
                })
            }
            return temp;
        }
Mar.17,2021

the parameter attrs traversed by the above method is an object, so the parameter obj in the each method is an object, and the parameter traversed by the following method matchs is an array returned after regular matching, so the parameter each is the value corresponding to the index index and the match index.


this should be an implementation of moustache syntax, first of all can not write each should be forEach, and there is a undefined you wrote wrong. The first blank should be an array, which is match.split ('.'), the second is obviously result [obj], and then the third is undefined.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e543be-45275.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e543be-45275.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?