Skip to content

Instantly share code, notes, and snippets.

@knownothingsnow
Created June 18, 2017 02:56
Show Gist options
  • Save knownothingsnow/193ecdd564af227eff0974080147c85e to your computer and use it in GitHub Desktop.
Save knownothingsnow/193ecdd564af227eff0974080147c85e to your computer and use it in GitHub Desktop.
一行代码生成星星评分
/**
* @func
* @desc 生成评分
* @param {number} rate [1-5]
* @returns {String}
*/
const getStar = (rate) => '★★★★★☆☆☆☆☆'.slice(5 - rate, 10 - rate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment