替换数组内的元素
根据指定规则替换数组中的元素,Ruby也提供了以下方法:
ary.collect { |item| …}
ary.collect! { |item| …}
ary.map { |item| …}
ary.map! { |item| …}
将数组ary中的各元素item传递给块做处理。
1 | ary = [1, 2, 3] |
根据指定规则替换数组中的元素,Ruby也提供了以下方法:
ary.collect { |item| …}
ary.collect! { |item| …}
ary.map { |item| …}
ary.map! { |item| …}
将数组ary中的各元素item传递给块做处理。
1 | ary = [1, 2, 3] |
Recently, I’ve encoutered a weird problem in the project, it’s about the value of the ngModel. Let me explain the problem. see the code
1 |
|