how to trim the file name when length more than 10 in angular

Solutions on MaxInterview for how to trim the file name when length more than 10 in angular by the best coders in the world

showing results for - "how to trim the file name when length more than 10 in angular"
Ivan
02 Aug 2019
1    <script src="js/jquery.js"></script>
2    <script>
3     $(document).ready(function(){
4                    $('.uploadFilesItemHeader').find('#fileName').each(function() {
5                    var fileNames = this.innerText;
6                    var leftRightStrings = fileNames.split('.');
7                    //file name
8                    var fName = leftRightStrings[0];
9                    //file extension
10                    var fExtention = leftRightStrings[1];
11                    var lengthFname = fName.length;
12                    //if file name without extension contains more than 15 characters   
13                    if(lengthFname > 15){
14                        $(this).html(fName.substr(0,10) + "..." + fName.substr(-5) + "." +fExtention);
15                    }    
16        }); 
17}); 
18    <script>
19