标签:问题 接受 UNC title log dsa meta 打印 dex
问题:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <script> var str1 = "abcdabcabcaabeeeeeee"; var str2 = "fhjdiovjdasklgudsaklfgdasklfjadkslfds"; var sum = 0; var arr = []; function count(str1) { for (var i = 0; i < str1.length; i++) { var arr1 = str1.split(‘‘); if (arr.indexOf(arr1[i]) == -1) { arr.push(arr1[i]); } } console.log(arr1) for (var j = 0; j < arr.length; j++) { for (var m = 0; m < arr1.length; m++) { if (arr[j] == arr1[m]) { sum += 1; } } console.log(arr[j] + ‘次数为:‘ + sum); sum = 0; } } count(str2); </script> </body> </html>
标签:问题 接受 UNC title log dsa meta 打印 dex
原文地址:https://www.cnblogs.com/sjl9280/p/13193775.html