手機號隱藏

var phone = '13312341234';
function substrPhone(phone, replace, num1, num2) {
	var start = phone.substring(0, num1);
	var end = phone.substring(phone.length - num2, phone.length);
	console.log(end);
	return start + replace + end;
}
var newPhone = substrPhone(phone, '********', 3, 0);
console.log(newPhone) // 133********
相關文章
相關標籤/搜索