Converting strings to numbers in JavaScript

Converting strings to numbers in JavaScript

kudvenkat

10 лет назад

162,937 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@hardik1540
@hardik1540 - 06.11.2014 09:26

Try 123abc in any one textbox and press add..
and plz give the solution

Ответить
@shaikibrahim398
@shaikibrahim398 - 19.01.2015 15:01

Dear Venkat, Thanks for your clear and understandable articles on .Net Technologies, I request you to please post videos on CSS.

Ответить
@saralapuram
@saralapuram - 27.07.2015 10:09

Hi Venkat, Thanks for the tutorial. I typed the code in notepad, notepad++ and in Dreamweaver but when I saw the html page in browser it is showing, one table with border and names of the text fields alone. Text fields are not displayed. Why?, will you please help.

Ответить
@zuberdeveloper1944
@zuberdeveloper1944 - 07.08.2015 09:28

Thanks venkat

Ответить
@adrianmbugua8344
@adrianmbugua8344 - 18.10.2015 22:00

I love your examples because they solve real world problems !

Ответить
@malwina7221
@malwina7221 - 20.07.2016 23:53

Thank you very much for this video.

Ответить
@Rattus1
@Rattus1 - 02.12.2016 03:46

this man is the truth! shout out to all my Indians out there!

Ответить
@yogeshpatil6896
@yogeshpatil6896 - 29.12.2016 11:51

what about when we want both int as well as float

Ответить
@onee
@onee - 22.04.2017 15:39

Just out of curiosity (I'm new to JavaScript) why wouldn't you use input type="number" instead of input type="text"?

Ответить
@sinolamp3448
@sinolamp3448 - 07.07.2017 23:33

i did it like this...

html --------------------------------

<input id="firstNumber" placeholder="0" /><br />
<input id="secondNumber" placeholder="0" /><br />
<button onclick="myNumber()">Add</button>
<p id="showNumber"></p>

-----------------end of html--------------------

java script ----------------------------------

function myNumber() {
var x, y, display;
display = document.getElementById("showNumber");
x = Number(document.getElementById('firstNumber').value);
y = Number(document.getElementById("secondNumber").value);
display.innerHTML = x + y;
if(isNaN(x) && isNaN(y)) {
display.innerHTML = "input numbers";
return;
}
if(isNaN(x)) {
display.innerHTML = "first box is not a number";
return;
}
if(isNaN(y)) {
display.innerHTML = "second box is not a number";
return;
}
}

-----------------------end of js-------------------------

umm is it good?

Ответить
@sandipghoshal2122
@sandipghoshal2122 - 13.08.2017 10:05

Thank you for the tutorial but IsNan methond not working

Ответить
@HashTravel920
@HashTravel920 - 16.01.2018 21:23

in tutorial number 7 you mentioned , we should not place the script file into head tag , but in this example you put the function "addNumber" in head tag. I am kinda confuse .

Ответить
@vatsaljoshi4390
@vatsaljoshi4390 - 26.01.2018 16:23

best explanation thanks

Ответить
@obeid1000071
@obeid1000071 - 10.03.2018 20:57

Hello , how we can save a control like textbox in a data base ??

Ответить
@ronidey380
@ronidey380 - 25.03.2018 13:55

Thank you sir😊

Ответить
@shivayogaji
@shivayogaji - 24.05.2018 00:23

I love the way you explain. <3 Thank you :-)

Ответить
@ajaykushwaha6137
@ajaykushwaha6137 - 17.06.2018 15:57

I was doing it in simple forms and after using isNaN function my whole code was not working infact nothing was working afterwards.
Can you suggest me the error ?

Ответить
@shivampandey5493
@shivampandey5493 - 16.10.2018 21:36

Very great work for giving this useful lectures to us, thanks brother.
please make a series on one complete project with JS oops also, it will be a great help..

Ответить
@oprincesschristy324
@oprincesschristy324 - 11.01.2019 14:59

Your Explanation is highly simplified and simple. Your videos have been of great help to me. keep doing the good job.

Ответить
@mpauser8399
@mpauser8399 - 13.06.2019 13:32

I love the way you explain your the best teacher

Ответить
@saeeda.2652
@saeeda.2652 - 15.10.2019 13:51

thank you so much I needed this :)

Ответить
@souvikdutta3567
@souvikdutta3567 - 20.11.2019 10:15

when i tried to do minus then it is not working can you help me

Ответить
@deepakbhardwaj5432
@deepakbhardwaj5432 - 11.10.2020 11:06

Please make on Universal Windows Platform

Ответить
@srinivaspagidi5764
@srinivaspagidi5764 - 28.06.2021 09:25

Your explanation is highly simple and this video have been of great help to me.
Thank you so much.

Ответить
@ishansharma9152
@ishansharma9152 - 25.09.2021 12:28

don't these methods parseFloat and parseInt throw any exception while parsing text ?

Ответить
@YusufKhan-it4wc
@YusufKhan-it4wc - 19.01.2022 15:33

Now Learning JavaScript.. This playlist Helpful even now..

Ответить
@ebadrehman6049
@ebadrehman6049 - 23.02.2022 00:54

Thank you so much .This tutorial is very helpful to me.

Ответить
@computer_programming_gk
@computer_programming_gk - 22.11.2022 08:26

Simple & Superb tutorial

Ответить
@LadduLaddu-kr5jy
@LadduLaddu-kr5jy - 05.09.2024 11:39

This type of explanation is mostly required for everyone ❤

Ответить