<
script
>
var
some = [
'是',
'时',
'了',
'我',
'的',
'题',
'库',
'紫',
'赋',
'传',
'了',
'我'];
var
text = [
'我',
'是',
'题',
'库',
'了'];
var
text1 =
JSON.
parse(
JSON.
stringify(
text));
var
some1 =
JSON.
parse(
JSON.
stringify(
some));
//深拷贝
let
arr = [];
some[
1]=
'好'
console.
log(
'some:',
some);
console.
log(
'some1:',
some1);
console.
log(
'text:',
text);
console.
log(
'text1:',
text);
text1.
toString();
some1.
toString();
for(
let
i =
0;
i <
text.
length;
i++){
console.
log(
some1.
indexOf(
text[
i]));
arr.
push(
some1.
indexOf(
text[
i]));
}
console.
log(
arr);
<
/
script
>