Interview of Chinese IT companies Ratings and Reviews website/app
Interview of Chinese IT companies Ratings and Reviews website/app
💩💩💩💩💩
👍👍👍👍👍
👎👎👎👎👎
// js hack
const getShitRank = (strings, ...values) => {
let str = `★★★★★☆☆☆☆☆`;
const rate = values[0] || 0;
if(strings[0]) {
str = strings[0];
}
return str.slice(5 - rate, 10 - rate);;
}
getShitRank`👍👍👍👍👍👎👎👎👎👎${1}`;
getShitRank`💩💩💩💩💩👎👎👎👎👎 ${1}`;
getShitRank`🍅🍅🍅🍅🍅💩💩💩💩💩 ${1}`;
emoji bug
Unicode bug???
// emoji bug
`🍅🍅🍅🍅🍅💩💩💩💩💩`.slice(4, 9)
// "🍅🍅�"
`🍅🍅🍅🍅🍅⭐️⭐️⭐️⭐️⭐️`.slice(4, 9)
// "🍅🍅�"
`★★★★★☆☆☆☆☆`.slice(4, 9)
// "★☆☆☆☆"
solution OK
const getShitRanking = (strings, ...values) => {
const rate = values[0] || 0;
let str = `★★★★★☆☆☆☆☆`;
let start = 5 - rate;
let end = 10 - rate;
if(strings[0]) {
str = strings[0].trim();
start = (5 - rate) * (Math.ceil(str.length/10));
end = (10 - rate) * (Math.ceil(str.length/10));
}
return str.slice(start, end);;
}
getShitRank`👍👍👍👍👍👎👎👎👎👎${1}`;
// "👍👎👎👎👎"
getShitRank`💩💩💩💩💩👎👎👎👎👎 ${1}`;
// "💩👎👎👎👎"
getShitRank`🍅🍅🍅🍅🍅💩💩💩💩💩 ${1}`;
// "🍅💩💩💩💩"
refs
Rotten Tomatoes (烂番茄)
https://www.rottentomatoes.com/
两种评分体系:
TOMATOMETER® 番茄值 --- 对应专业评审评分
AUDIENCE SCORE 爆米花值 --- 对应普通观众评分
https://www.jianshu.com/p/32efef9d9714
douban 豆瓣
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13233442.html
未经授权禁止转载,违者必究!