Home > Article > Web Front-end > Instructions for using the path.extname method in node.js_node.js
Method description:
Returns the path file extension. If the path ends with '.', '.' will be returned. If there is no extension and does not end with '.', a null value will be returned.
Grammar:
Since this method belongs to the path module, the path module needs to be introduced before use (var path= require(“path”) )
Receive parameters:
p path
Example:
Source code: