您现在的位置是:首页>学习分享
浅谈join()和split()的区别 2019-08-28 113
<script type="text/javascript">
    const array1 = [1,222,55,'rygf','ggfh',false];
    function arr(array) {
        console.log(array.join("#")); // 1#222#55#rygf#ggfh#false 将数组分割成字符串
        console.log("How are you".split("")); // ["H", "o", "w", " ", "a", "r", "e", " ", "y", "o", "u"] 将一个字符串分割成字符串数组.
    }
    arr(array1);
    const [a,b,c] = [1,2,'5555'];
    console.log(a,b,c);
</script>
文章评论
小程序端
  • 微信公众号
  • 我的微信

Copyright © www.zhangqingblog.com All Rights Reserved.

备案号:鄂ICP备18005731号-2