Skip to content

Commit bbd73be

Browse files
committed
commit
1 parent 9ef7c93 commit bbd73be

File tree

1 file changed

+15
-6
lines changed
  • 09-Data-Structures-Operators/starter

1 file changed

+15
-6
lines changed

09-Data-Structures-Operators/starter/string.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ const flights =
1313

1414
const newFlights = flights.split('+');
1515

16-
16+
const formtSlice = str => str.toUpperCase().slice(0,3);
1717
for (let i = 0; i < newFlights.length; i ++){
1818
/*arrayFlights.push(newFlights[i].replaceAll(newFlights[i][0],'').replaceAll(';',' '))*/
19-
const[fours, secon, terc, quart] = newFlights[i].replace('_','').split(';')
20-
const arrafligts = [fours.replace('_',' ').padStart(25,'.'),'from',secon.toUpperCase().slice(0,3),'to', terc.toUpperCase().slice(0,3), quart]
21-
console.log(arrafligts.join(' '))
19+
const[fours, secon, terc, quart] = newFlights[i].replace('_','').split(';');
20+
const arrafligts = [fours.replace('_',' ').padStart(25,'.'),'from',formtSlice(secon),'to', formtSlice(terc), `(${quart})`];
21+
/*console.log(arrafligts.join(' '));*/
2222
}
2323

2424

@@ -29,6 +29,15 @@ for (let i = 0; i < newFlights.length; i ++){
2929
const novoarray = [frist, 'from', second.toUpperCase().slice(0,3), 'to', terce.toUpperCase().slice(0,3), hours]
3030
}*/
3131

32-
for (const flight of flights.split('+')){
32+
const strignumber = '5253201210928336';
33+
/*const novoarray = new Array(strignumber.slice(0,4))
34+
novoarray.push(strignumber.slice(4,8))
35+
novoarray.push(strignumber.slice(8,12))
36+
novoarray.push(strignumber.slice(12,16))
37+
console.log(novoarray.join(' '))*/
38+
const novoarray = [];
39+
for (let i =0; i < strignumber.length; i+= 4){
40+
novoarray.push(strignumber.slice(i, i + 4))
41+
}
3342

34-
}
43+
console.log(novoarray.join(' '))

0 commit comments

Comments
 (0)