Wednesday, May 25, 2022

The code final Js

 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>String making parts of parts</title>
</head>
<body>
    <ul>
        <caption><h2>Live output</h2></caption>
        <li>MAN675847583748sjt567654;Manchester Piccadilly</li>
        <li>GNF576746573fhdg4737dh;Greenfield</li>
        <li>LIV5hd737456236dch46dg4;Liverpool Lime Street</li>
        <li>SYB4f65hf75f75f736463;Stalybridge</li>
        <li>HUD5767ghtyfyr4536dh45dg45dg3;Huddersfield</li>
       
    </ul>
   
    <script>
       
            const list = document.querySelector('ul'); // Test conflict
       
        list.innerHTML = '';
       
        let stations = ['MAN675847583748sjt567654;Manchester Piccadilly', 'GNF576746573fhdg4737dh;Greenfield', 'LIV5hd737456236dch46dg4;Liverpool Lime Street', 'SYB4f65hf75f75f736463;Stalybridge', 'HUD5767ghtyfyr4536dh45dg45dg3;Huddersfield'];
       
        for (let station of stations){
           
            let letters3 = station.slice(0,3);
           
            let semiCol = station.indexOf(';');
           
            let frase = letters3 +' : '+ station.slice(semiCol+1);
           
            // Write your code just below here
            const result = frase;
            const listItem = document.createElement('li');
            listItem.textContent = result;
            list.appendChild(listItem);
        }

    </script>

</body>
</html>

Rute Bezerra de Menezes Gondim 





No comments:

Post a Comment