map method in js

reference this

1.high:

           var map = {
                "调研背景": background,
                "调研目的": purpose,
                '调研安排': arrangement,
            };
            var str='';
            for (var key in map) {
                console.log("map["+key+"]"+map[key]);
                str += '<div class="outer">\
                        <div class="div-title">' + key + '</div>\
                        <div class="div-content">' + map[key] + '</div>\
                     </div>';
            }

            $('.content').html(str);    

2.low:

    function myHtml(title,content) {
    return '<div class="outer">\
        <div class="div-title">' + title + '</div>\
        <div class="div-content">' + content + '</div>\
    </div>';
    }
            
     (function(){  
         //notice the order
           var str= myHtml('调研背景',background)+
            myHtml('调研目的',purpose)+
            myHtml('调研安排',arrangement);            
            $('.content').html(str);
})();    
lower than the number 1

 

posted on 2017-11-16 15:55  鸣动我心  阅读(182)  评论(0编辑  收藏  举报