Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(str) {
- let text=str.split(' ');
- let re = new RegExp('^\\*[A-Z][a-z]+\\*$');
- let name=[];
- text = text.map((a) => {
- if (a.match(re)){
- name.push(a);}
- else {return a;}});
- console.log(name.join(', '));
- console.log('*'.repeat(20));
- console.log(text.filter(arr => arr).join(' '));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement