+ 3

Javascript help!

Write js function by name test Theat subtracts B value from A and then stores the results in C and uses them as output .

17th Oct 2018, 12:01 AM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
12 Réponses
17th Oct 2018, 12:28 AM
qwerty
qwerty - avatar
+ 6
qwerty are we practicing patience ☑
17th Oct 2018, 1:24 AM
BroFar
BroFar - avatar
+ 5
Have you tried it yourself? Show us your attempt and tell us what your problem is.
17th Oct 2018, 12:14 AM
qwerty
qwerty - avatar
+ 5
Omar Khalil Bakhsh Here is another way. function test (A,B) { var c =B-A; return c; } document.write(test(4,6)); //Output 2
17th Oct 2018, 12:34 AM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
+ 5
qwerty OK! I understand it.
17th Oct 2018, 12:51 AM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
+ 5
function test (A,B) { var c =A-B; return c; } document.write(test(6,4)); //Output 2
17th Oct 2018, 12:51 AM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
+ 4
qwerty function test (A,B) { var c =B-A; return c; document.write(c); } he say it is wrong 😓
17th Oct 2018, 12:20 AM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 4
Subtract B from A means A-B, not B-A. Also remove return c;
17th Oct 2018, 12:24 AM
qwerty
qwerty - avatar
+ 4
Warith Vatanaplachaigoon Subtract B from A means A-B. Subtract A from B means B-A.
17th Oct 2018, 12:38 AM
qwerty
qwerty - avatar
+ 3
qwerty yes i did
17th Oct 2018, 12:17 AM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 3
thanks i will practise more +
17th Oct 2018, 12:31 AM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 2
Show us your attempt
17th Oct 2018, 12:17 AM
qwerty
qwerty - avatar