Goal: To prevent the ends of the cord from fraying,

Which of the following methods is more reasonable for accomplishing this goal?
Use a lighter to melt each end of the cord