Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
271 views
in Technique[技术] by (71.8m points)

javascript - Addition turns into concatenation

var Height=  (rowData.length * 30) + PPPP.top + 10 ;

When i print this i get 9013510... instead of 90 +135+10 = 235. Why does mine turns into concatentaion instead of Addition.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You probably need to convert PPPP.top to a number, eg.

var Height = (rowData.length * 30) + parseFloat(PPPP.top) + 10;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...