Here we will take an example of Using split() and pop() method
Split() method helps you to split the filename into two parts, one is the filename and the second will be the extension of the file.
For getting the extension name we are using the pop() method on the array. It returns and removes the last element of the array.
Let's take an example: