如何比较两个数组并将一个数组转换为另一个数组

时间:2019-02-11 21:48:15

标签: typescript

如何获取两个数组并进行比较,然后将另一个替换。
示例:假设我有2个数组:add_filter( 'woocommerce_get_breadcrumb', 'remove_shop_crumb', 20, 2 ); function remove_shop_crumb( $crumbs, $breadcrumb ){ foreach( $crumbs as $key => $crumb ){ if( $crumb[0] === __('Shop', 'Woocommerce') ) { unset($crumbs[$key]); } } return $crumbs; } theArray1

theArray2

两个数组看起来像是相同的,但事实并非如此。让let theArray1 = ['Sam', 'jessica', 'theStore']; let theArray2 =['sam', 'Jessica #' , 'TheStore']; 作为参考。将theArray1转换为theArray2以便我可以做到的最有效方法是什么:

theArray1

我尝试复制另一个以expect(theArray1).to.be.equalTo(theArray2). 作为参考的数组,但这不是问题。问题是我想操纵theArray1使其与theArray2相同。

0 个答案:

没有答案
相关问题