<i id='n7lC8'><tr id='n7lC8'><dt id='n7lC8'><q id='n7lC8'><span id='n7lC8'><b id='n7lC8'><form id='n7lC8'><ins id='n7lC8'></ins><ul id='n7lC8'></ul><sub id='n7lC8'></sub></form><legend id='n7lC8'></legend><bdo id='n7lC8'><pre id='n7lC8'><center id='n7lC8'></center></pre></bdo></b><th id='n7lC8'></th></span></q></dt></tr></i><div id='n7lC8'><tfoot id='n7lC8'></tfoot><dl id='n7lC8'><fieldset id='n7lC8'></fieldset></dl></div>
  • <small id='n7lC8'></small><noframes id='n7lC8'>

  • <legend id='n7lC8'><style id='n7lC8'><dir id='n7lC8'><q id='n7lC8'></q></dir></style></legend>

        <tfoot id='n7lC8'></tfoot>
        • <bdo id='n7lC8'></bdo><ul id='n7lC8'></ul>
      1. 将两个数组(键和值)合并为一个对象

        时间:2024-04-20

          <small id='Iq3Gw'></small><noframes id='Iq3Gw'>

            <bdo id='Iq3Gw'></bdo><ul id='Iq3Gw'></ul>

              • <i id='Iq3Gw'><tr id='Iq3Gw'><dt id='Iq3Gw'><q id='Iq3Gw'><span id='Iq3Gw'><b id='Iq3Gw'><form id='Iq3Gw'><ins id='Iq3Gw'></ins><ul id='Iq3Gw'></ul><sub id='Iq3Gw'></sub></form><legend id='Iq3Gw'></legend><bdo id='Iq3Gw'><pre id='Iq3Gw'><center id='Iq3Gw'></center></pre></bdo></b><th id='Iq3Gw'></th></span></q></dt></tr></i><div id='Iq3Gw'><tfoot id='Iq3Gw'></tfoot><dl id='Iq3Gw'><fieldset id='Iq3Gw'></fieldset></dl></div>
                <tfoot id='Iq3Gw'></tfoot>
              • <legend id='Iq3Gw'><style id='Iq3Gw'><dir id='Iq3Gw'><q id='Iq3Gw'></q></dir></style></legend>

                    <tbody id='Iq3Gw'></tbody>
                  本文介绍了将两个数组(键和值)合并为一个对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Is there a common Javascript/Coffeescript-specific idiom I can use to accomplish this? Mainly out of curiosity.

                  I have two arrays, one consisting of the desired keys and the other one consisting of the desired values, and I want to merge this in to an object.

                  keys = ['one', 'two', 'three']
                  values = ['a', 'b', 'c']
                  

                  解决方案

                  var r = {},
                      i,
                      keys = ['one', 'two', 'three'],
                      values = ['a', 'b', 'c'];
                  
                  for (let i = 0; i < keys.length; i++) {
                      r[keys[i]] = values[i];
                  }
                  
                  console.log(r);

                  .as-console-wrapper { max-height: 100% !important; top: 0; }

                  这篇关于将两个数组(键和值)合并为一个对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 props 传递给 React Router 子路由 下一篇:使用 will_paginate gem 在 Rails 3.2.3 中调用 Ajax

                  相关文章

                    <bdo id='BoLhq'></bdo><ul id='BoLhq'></ul>

                    <legend id='BoLhq'><style id='BoLhq'><dir id='BoLhq'><q id='BoLhq'></q></dir></style></legend>
                    <i id='BoLhq'><tr id='BoLhq'><dt id='BoLhq'><q id='BoLhq'><span id='BoLhq'><b id='BoLhq'><form id='BoLhq'><ins id='BoLhq'></ins><ul id='BoLhq'></ul><sub id='BoLhq'></sub></form><legend id='BoLhq'></legend><bdo id='BoLhq'><pre id='BoLhq'><center id='BoLhq'></center></pre></bdo></b><th id='BoLhq'></th></span></q></dt></tr></i><div id='BoLhq'><tfoot id='BoLhq'></tfoot><dl id='BoLhq'><fieldset id='BoLhq'></fieldset></dl></div>
                  1. <tfoot id='BoLhq'></tfoot>
                    1. <small id='BoLhq'></small><noframes id='BoLhq'>