Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function a(input) {
- input = input.map(Number);
- let arr = [];
- let biggest;
- input.forEach(function(e){
- if (biggest != undefined){
- if (e >= biggest){
- arr.push(e);
- biggest = e;
- }
- }
- else{
- biggest = e;
- arr.push(e);
- }
- });
- arr.forEach(e => console.log(e));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement