标签:var span bre lap str color inf png play
// 一个字符串由[a-z]组成,请找出该字符串第一个只出现一次的字母; var str = "354691236549870213654789501287i45465444" var obj = {};//去重 for(var i = 0; i < str.length;i++){ var count = 1; obj[str[i]] = count; } arr = Object.keys(obj); var arr_ = []; for(i in arr){ var num = 0; for(j = 0;j<str.length;j++){ if(str[j] == arr[i]){ num ++; } } arr_.push(num) } var num_ = 0; for(i in arr_){ if(arr_[i]!=1){ num_+=1 }else{ break } } console.log(arr[num_])
标签:var span bre lap str color inf png play
原文地址:https://www.cnblogs.com/hmd180324/p/9228606.html