Flashcards
HIGHER ORDER FUNCTIONZ
Flashcards do conjunto (2)
- 1.replace()The replace() method searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced.
*** str.replace(/blue/g, "red")
*** str.replace(/,/g, "")
*** can also take function at end!!!
var res = str.replace(/blue|house|car/gi, function myFunction(x){return x.toUpperCase();}) - 2.filter()filters an array, returns an array where of values that meet a criteria.
var ages = [32, 33, 16, 40];
function checkAdult(age) {
return age >= 18; }
var result = ages.filter(checkAdult);
}
Informações
- Descrição
- MCAT Computer Studies FlashCards sobre HIGHER ORDER FUNCTIONZ, criado por ig ag em 17-09-2016.
- Criado por
- ig ag · set 2016
- Atualizado
- 19 set 2016
- Visualizações
- 0
- Avaliação