<!DOCTYPE html>
<html>
<body>
<Script>
"use strict";
function truncate (str, maxlength){
if(str.length >= maxlength){
alert(str.substring(0,maxlength) + "...");
}
else alert(str);
}
truncate("What I'd like to tell on this topic is:", 20);
truncate("Hi everyone!", 20);
</Script>
</body>
</html>
<html>
<body>
<Script>
"use strict";
function truncate (str, maxlength){
if(str.length >= maxlength){
alert(str.substring(0,maxlength) + "...");
}
else alert(str);
}
truncate("What I'd like to tell on this topic is:", 20);
truncate("Hi everyone!", 20);
</Script>
</body>
</html>
댓글
댓글 쓰기