JSFiddle - React, Tailwind, and code Playground

by stevenally

JavaScript

fileName = "xxx.yyy";
           
           for (pos = fileName.length; pos >= 0; pos--)
           {
               
               if (fileName.charAt(pos) == '.') 
               {
                   start = pos + 1;
                   break;
               }
           }
fileName1 = fileName.substring(0,pos);
fileExt = fileName.substr(pos+1);

alert (fileName1);
alert (fileExt);