Click here to Skip to main content
15,073,184 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionMessage Closed Pin
5-Oct-21 21:16
MemberMember 153836495-Oct-21 21:16 
AnswerRe: sytax error unexcepted token Pin
OriginalGriff5-Oct-21 21:20
mveOriginalGriff5-Oct-21 21:20 
GeneralRe: sytax error unexcepted token Pin
Richard Deeming5-Oct-21 21:44
mveRichard Deeming5-Oct-21 21:44 
GeneralRe: sytax error unexcepted token Pin
OriginalGriff5-Oct-21 21:52
mveOriginalGriff5-Oct-21 21:52 
Questiondata import via API Pin
Francesco Reboldi23-Sep-21 19:28
MemberFrancesco Reboldi23-Sep-21 19:28 
AnswerRe: data import via API Pin
Afzaal Ahmad Zeeshan23-Sep-21 23:47
mveAfzaal Ahmad Zeeshan23-Sep-21 23:47 
GeneralMessage Closed Pin
24-Sep-21 2:13
MemberFrancesco Reboldi24-Sep-21 2:13 
GeneralRe: data import via API Pin
Afzaal Ahmad Zeeshan24-Sep-21 4:11
mveAfzaal Ahmad Zeeshan24-Sep-21 4:11 
GeneralRe: data import via API Pin
Francesco Reboldi24-Sep-21 5:13
MemberFrancesco Reboldi24-Sep-21 5:13 
GeneralRe: data import via API Pin
Francesco Reboldi25-Sep-21 6:26
MemberFrancesco Reboldi25-Sep-21 6:26 
QuestionRegex not keeping the . or decimal with currency value with keydown event. Pin
jkirkerx23-Sep-21 9:06
professionaljkirkerx23-Sep-21 9:06 
AnswerRe: Regex not keeping the . or decimal with currency value with keydown event. Pin
Member 1532961323-Sep-21 9:32
MemberMember 1532961323-Sep-21 9:32 
GeneralRe: Regex not keeping the . or decimal with currency value with keydown event. Pin
jkirkerx23-Sep-21 9:39
professionaljkirkerx23-Sep-21 9:39 
GeneralRe: Regex not keeping the . or decimal with currency value with keydown event. Pin
Member 1532961324-Sep-21 1:07
MemberMember 1532961324-Sep-21 1:07 
AnswerRe: Regex not keeping the . or decimal with currency value with keydown event. Pin
jkirkerx29-Sep-21 12:19
professionaljkirkerx29-Sep-21 12:19 
GeneralRe: Regex not keeping the . or decimal with currency value with keydown event. [Perhaps Solved] Pin
jkirkerx29-Sep-21 13:18
professionaljkirkerx29-Sep-21 13:18 
QuestionMessage Closed Pin
20-Sep-21 2:14
MemberMember 1536430420-Sep-21 2:14 
QuestionMessage Closed Pin
20-Sep-21 0:43
MemberAsfand Ali20-Sep-21 0:43 
QuestionHow does the compare function work with numerical sort? Pin
Ryan Blake 202126-Aug-21 15:51
MemberRyan Blake 202126-Aug-21 15:51 
I'm taking the w3schools tutorial on javascript. In the tutorial it is discussing numerical sort. It says since javascript doesn't sort numerals you need to use a trick of employing a comparison function with sort.

JavaScript
<pre><!DOCTYPE html>
<html>
<body>

<h2>JavaScript Array Sort</h2>
<p>Click the button to sort the array in ascending order.</p>

<button onclick="myFunction()">Try it</button>
<p id="demo"></p>

<script>
const points = [40, 100, 1, 5, 25, 10];
document.getElementById("demo").innerHTML = points;  

function myFunction() {
  points.sort(function(a, b){return a - b});
  document.getElementById("demo").innerHTML = points;
}
</script>

</body>
</html>


How does function(a, b) get the input a and b? If you could give a detailed message because I'm not getting how it all works.
AnswerRe: How does the compare function work with numerical sort? Pin
Peter_in_278026-Aug-21 18:22
professionalPeter_in_278026-Aug-21 18:22 
GeneralRe: How does the compare function work with numerical sort? Pin
Ryan Blake 202128-Aug-21 13:45
MemberRyan Blake 202128-Aug-21 13:45 
QuestionBrowser Side Recovery Pin
milo-xml3-Aug-21 9:06
professionalmilo-xml3-Aug-21 9:06 
AnswerRe: Browser Side Recovery Pin
Richard Deeming3-Aug-21 23:48
mveRichard Deeming3-Aug-21 23:48 
GeneralRe: Browser Side Recovery Pin
milo-xml4-Aug-21 3:20
professionalmilo-xml4-Aug-21 3:20 
Questioni have been learning javascript for a long time now but still dont know what to build Pin
samuel unachukwu23-Jul-21 22:47
Membersamuel unachukwu23-Jul-21 22:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.