How to reverse words in a string without using a built-in functions in JavaScript? [duplicate]

`

    str = "Welcome to the World of AI!";
    function strReverse(str) {  

        let reversed = ""; 
        for(i = 0; i < str.length; i++){ 
            reversed += str[str.length - 1 - i];  
        } 
        b=reversed.split(' ').reverse()
        return b; 
    } 

    console.log(strReverse(str));`

Input: Welcome to the World of AI!

Output: emocleW ot eth dlroW fo !IA

string = “Welcome to the World of AI!”;

without using split, reverse functions.

it should reverse each of word of that string.

please help me to solve this.