I want something like this:
(我想要这样的东西:)
var string = "apple banana";
var array = ["apple", "banana", "orange", "grape"];
for(var i=0;i<array.length;i++){
if(array[i] is found in (string) {
remove the value;
}
}
something like that.
(这样的事情。)
so basically, it would:(所以基本上,它将:)
Declare a string and an array
(声明一个字符串和一个数组)
Iterate through the array
(遍历数组)
If the array[i] value is present exactly in the string, it would remove it
(如果array [i]值恰好存在于字符串中,它将删除它)
- The iteration should continue as normal
(迭代应该照常继续)
In case it still doesnt make sense:
(如果仍然没有意义:)
String is "1 3 bc"
(字符串是“ 1 3 bc”)
Array contains "1", "2","3", "a", "b", "c"
(数组包含“ 1”,“ 2”,“ 3”,“ a”,“ b”,“ c”)
The array should now only contain "2" and "a".
(数组现在应该只包含“ 2”和“ a”。)
ask by Carson Rueter translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…