Exercise: Using recursion and regular expressions
Modify the recursive example to include a function changeText
that consumes a node, a pattern, and a modifier and changes all descendant text nodes using that pattern and modifier. Using the function, remove all the lower-case vowels from the text on the page.
Note:
Hints:
Make sure to use all three parameters each time you call the function
changeText
.
Solution to the exercise
Here is one possible solution.
Note:
Hints:
- undefined
1
2
window.onload = startFunction;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX