Javascript Definition and 73 Threads

JavaScript (), often abbreviated as JS, is a programming language that conforms to the ECMAScript specification. JavaScript is high-level, often just-in-time compiled, and multi-paradigm. It has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions.
Alongside HTML and CSS, JavaScript is one of the core technologies of the World Wide Web. Over 97% of websites use it client-side for web page behavior, often incorporating third-party libraries. All major web browsers have a dedicated JavaScript engine to execute the code on the user's device.
As a multi-paradigm language, JavaScript supports event-driven, functional, and imperative programming styles. It has application programming interfaces (APIs) for working with text, dates, regular expressions, standard data structures, and the Document Object Model (DOM).
The ECMAScript standard does not include any input/output (I/O), such as networking, storage, or graphics facilities. In practice, the web browser or other runtime system provides JavaScript APIs for I/O.
JavaScript engines were originally used only in web browsers, but they are now core components of other software systems, most notably servers and a variety of applications.
Although there are similarities between JavaScript and Java, including language name, syntax, and respective standard libraries, the two languages are distinct and differ greatly in design.

View More On Wikipedia.org
  1. D

    HTML/CSS Is it possible to use js variables in html while using Puppeteer?

    Hi everyone I'm using Visual Studio Code and would like to use a variable from a JavaScript file in my html code. This is easy enough to do until I try using Puppeteer in the JS file. If I add the following line to the JS code, I can no longer call my JS variable in the html file. const...
  2. shivajikobardan

    Comp Sci Blackjack program in javascript

    let card_value = 0; let count_of_a = 0; let number_of_cards = Number(prompt("Enter the number of cards.")); if (number_of_cards >= 2 && number_of_cards <= 5) { let cards = []; for (let i = 0; i < number_of_cards; i++) { cards[i] = prompt("Enter the value of card "); } var dict = {...
  3. shivajikobardan

    Java Why use spread operator when sorting an array in JavaScript?

    I Understand the basic theory behind spread operator. const girlNames = ['Jessica', 'Emma', 'Amandine'] const newGirlNames = [...girlNames] console.log(newGirlNames) // Output: ["Jessica", "Emma", "Amandine"] But I don't understand when it's applied. See here. function createList() {...
  4. shivajikobardan

    Java How to paint an element in screen using javascript?

    <div class="body"> <div id="board"> <div id="bat" class="bat"></div> <div id="ball" class="ball"></div> </div> </div> This is my HTML. I've done CSS For all of them and generated this: Now, I want the bat to move left and right when I press arrow keys...
  5. shivajikobardan

    Java Input Direction confusion in snake game javascript

    Here's the full code: This is the code that I'm interested in:window.addEventListener("keydown", e => { inputDir = { x: 0, y: 1 }; moveSound.play(); switch (e.key) { case "ArrowUp": inputDir.x = 0; inputDir.y = -1; break; case "ArrowDown": inputDir.x =...
  6. shivajikobardan

    Java Promises hell/chaining promises in Javascript

    https://www.physicsforums.com/threads/how-to-rewrite-callback-hell-using-promises-as-well-as-async-await.1048282/#post-6833326 My goal is to convert the callback hell in question to using promises. The correct flow of program is: Order created Order received Preparing food Order ready order...
  7. shivajikobardan

    Java How does this Promise program flow work in javascript?

    Promises syntax that I learnt: let p = new Promise(function (resolve, reject) { let x = 20, y = 20; if (x == y) { resolve(); } else { reject(); } })p.then(function () { console.log("that's correct"); }) .catch(function () { console.log("that's not correct"); }) I...
  8. Bob Walance

    JavaScript Button click event image hiding is delayed

    My webpage project has a button labeled 'Harmonics' with a mouse-click event. I want an image to be hidden as soon as the button is clicked, however this doesn't happen. Here's a snippet of the html. It doesn't matter what order the two Javascript functions are called. The 'hidden' attribute...
  9. Bob Walance

    Java How to associate several component events to one JavaScript file?

    I am creating a web page that will have several buttons on it. When a button is pressed it will play a tone or combination of tones. With the Google Web Designer application, I can create a simple page with one button on it. I'm able to associate the clicking of that button with "Custom Code"...
  10. K

    Java A little question about Javascript Resistance Caculator

    Javascript Resistance Calculator The values of the resistor are calculated from the colour of the bands. The values of the colours are shown in Table 1. The first band is the tens values. The second band gives the units, the third band is a multiplying factor the factor being 10band value. The...
  11. T

    Java Javascript reading files: how should I have asked?

    Hello A few weeks ago (March 7) I asked how to have Javascript read a data file of numbers into an array. I now understand why this is such a challenge when running a code on a web page, locally. I have since found a sufficient workaround. I hope I can share it in the hope that someone can...
  12. T

    Java How can I read a local file into an array in JavaScript?

    Hello I am aware that it is not natural for JavaScript to read a file; however I see it is being done. I am trying to read a local file of 100 numbers (separated by line breaks) into an array in JavaScript (I am aware that there are better ways to do this, but this is going to be the way I...
  13. evinda

    HTML/CSS How can I implement a website using HTML and CSS without functionality?

    Hello! (Wave) I wanted to ask you if you are familiar with html, css, javascript and php... What is it about? 🤔 Here is for example an exercise: Implement in HTML and CSS the site that is shown below (the specifications are marked with red). The site will be without functionality. How would...
  14. T

    Java First, second, third and fourth generation + Python and Javascript

    Good Morning I have understood, as a general rule and category (and I realize all such attempts to categorize are fraught with danger), the four generations of languages, from as machine (first generation), to assembly (second generation), to compilable (third generation; e.g., C, FORTRAN) and...
  15. YoungPhysicist

    HTML/CSS Html5 <canvas> element related apps not working

    Recently I want to make a image adder in html, which is just a app that add the rgb value of each pixel in simple bmp files together.It can be used to grayscales and other things. I found this website that teches how to do that with the <canvas> element in html5...
  16. YoungPhysicist

    JavaScript How is PF's "CONTACT US" Button made?

    I would like to add a email sending feature to my website, something like the the "CONTACT US" button here on PF. When I was searching this topic online, I get various paragraphs from CodeProject and StackOverflow, I saw methods using mailto: and some other stuff, but none of those work on my...
  17. S

    Java Javascript library for QM calculations

    Does anyone know of a good library in javascript that would help to develop technically accurate animations? I know there is stuff in python, but I'd like things to happen in the browser. Apart from linear algebra with complex valued matrices and vectors, I'd like to have things like numerical...
  18. D

    HTML/CSS Editable html table and javascript

    Hi, I would like to provide a tool for some calculation as a html table whose values the user may change and subsequently submit a JS script which uses these values as input. Do you know of some easy to use library to get the data from the table into JS? Thank you, DrDu
  19. S

    Java Solve Java GUI Switch Problem: Create JLabels & JTextFields

    This is actually Java! My current problem: I need my switch statement to show only the given information for each selected shape. For example when I click "circle" on the drop down menu, I want my switch to ask for the radius only while showing my compute button and answer. When I click...
  20. kolleamm

    Java Why is JavaScript the Best Language for Web Design Despite Compatibility Issues?

    After doing some research I came to the conclusion that JavaScript is the best language to learn for web design. However now I'm seeing that some browsers do not support it. I'm confused then on why it's the best web design language as opposed to HTML if there are compatibility issues. Thanks...
  21. A

    Java How to communicate between javascript and php?

    Hi, I am having problems integrating HTML, Javascript and PHP. I am using the instructions at this website to transfer data from PHP to Javascript: http://www.dyn-web.com/tutorials/php-js/scalar.php and have set up the following simple code to simply transfer a PHP array to Javascript but I...
  22. sukalp

    Efficient Download of PDF from Teacher's Google Drive

    hello i wanted to ask you that if we have a teacher website name. when we open pdf of his website it opens in google drive. when i opened c++ assignments file was zipping download is taking time but i am unable to download. what is the correct procedure for downloading pdf of google drive
  23. A

    Java Problem working with multi-dimensional arrays in Javascript

    Hi, I'm writing an HTML/Javascript application that will handle a large amount of data segregated into a set of n rings, each ring will have a set of m branches, and each branch will have four arrays of data, V, N, I, B. I would like to create a 3-D array to hold this data but am having...
  24. A

    Java How to load web page with javascript quicker?

    Hi I have a web page with a 400-line WebGL 3D-rendering javascript which also loads a 45K data file of vertices and other data. It also has a lot of math code. I notice it takes a while to load on slower machines (about 5-7 seconds) as a message on the lower left of the screen reports the %...
  25. Kaura

    HTML/CSS Gravity Simulator: JavaScript & HTML Canvas Code Review

    Recently I have been working on a gravity simulator using JavaScript and HTML Canvas I know that is not the most practical method but it fits my current skill set at the moment I have worked out the basics but due to my lack of experience in coding I was simply looking for people who better...
  26. Michael27

    Java Javascript: Assigning anonymous functions to attributes

    I have the following code creating an object on a web page: My question is if the function(event) { // var id=myid; unbind(event, this); } part of the code below results in a unique instantiated function per anchor or will all anchors point to the...
  27. iamjon.smith

    JavaScript Why is my EXTJS Combobox displaying small list items?

    I am creating the following combobox: //stations store var stationStore = Ext.create('Ext.data.Store', { id: 'stationStore', fields:[{name: 'station'}] }); the store is build on app load, and is empty to start. At this point the combobox is hidden Once the user runs a search...
  28. Borg

    JavaScript 100,000 miles of driving visualized

    I thought that I would share some interesting visualizations that I have created from some personal driving data. I've recently been introduced to the wonderful world of the D3.js Javascript library. D3 stands for Data-Driven Documents is an extremely powerful and versatile data visualization...
  29. Borg

    Java Javascript Inheritance questions

    This is going to be a long post. :wideeyed: I have been teaching myself Javascript for a project that I'm working on and I am stuck on how to get inheritance working the way that I would like. If this was plain old Java, I would have been done days ago. Some background on the problem - I am...
  30. Nicosia1

    What is the Intersection of Computer Programming and Music in Nicosia?

    I am a computer programmer, mostly in Windows, but a little bit into open source, Linux and Java. I work a lot in javascript and SQL of one kind or another, both of which are utilized somehow via all common platforms. I am also interested in music, physics, and chemistry. I play piano and...
  31. lonely_nucleus

    JavaScript What scripts do websites like unitednuclear.com use?

    I recently finished a course of html and css at codeacademy.com and I think I learned a lot from that but I do not feel prepared to make websites that can, for example, load another page when a button is clicked. Overall I want to know what type of languages are used to program sites like...
  32. J

    Java Run Javascript after DOM is ready

    ... the situation where you want a function to be defined after the DOM is ready, but don't want it to execute right when the DOM is ready (as happens if you simply put it in a document.ready(...) function)?
  33. J

    Java Performance leak in my program (JavaScript)

    Any ideas much appreciated. Repro steps: Open this: http://jaminweb.com/projs/snakegame.php Change the speed to Fast Go get a couple pieces of food, lengthening your snake a few blocks Notice how it's already moving slower Code...
  34. J

    Java Can someone help me figure out the flaw here? (JavaScript)

    Either because I'm tired or because I'm stupid, I'm having trouble getting a method of my Snake Game to work correctly. This is the method that is supposed to reset the position of the snake's food. this.moveFood = function() { var tx, ty...
  35. adjacent

    Java Javascript multiplication tables

    I am learning Javascript and have made a multiplication table generating program. But it's about 1000x slower than C#. Is there any problem with this code? I used the same code as C#, just the syntax is different. Here is the code: <html> <head lang="en"> <meta charset="UTF-8">...
  36. J

    Java JavaScript: Can't figure out what's going wrong in my use of this API

    I've been trying to use Google's YT JS API to build a dynamic web page that plays Youtube videos back-to-back, i.e. a personal playlist. Here's the documentation for the API: https://developers.google.com/youtube/js_api_reference Right now I am struggling to get the first video to...
  37. J

    Java Using a JavaScript Function as a Class

    I figured out what the bug in my code is, but now I need to figure out how to best remedy it. Here's my function: function snake(C, C_h, C_w) { /* NOTE TO SELF: C is a Raphel object. Can't find a method to return the height and...
  38. J

    Java Need help with this recursive problem (JavaScript)

    Okay, so I have a function single_ops(w) that returns a JavaScript array of all strings that can be made from 1 operation on the string w: function single_ops(w) { /* Given a word w, return an array of all strings that are w with: (1) 1 letter inserted, that letter...
  39. J

    Java I want to better write this JavaScript procedure

    As you may have figured out, I'm obsessed with spending exorbitant amounts of time making optimizations to my code. Can anyone help me cut down on the number of comparisons in the following text2words function? The intent of the function should be easy to figure out from the comments...
  40. L

    Java [Javascript] How do I make a hitbox?

    Alright I'm trying to make a game using Java-Script, it is a 2-D side scroller if ( xPositions[i]>this.x && xPositions[i]<this.x+50 && yPositions[i]>y && yPositions[i]<y+50) { y-= 5; fill(255, 255, 255, 127); stroke(0, 0, 0, 127); rect(80, 110, 280, 150, 15)...
  41. R

    Java Advanced Javascript Courseware Recommendations

    I'm looking for recommendations for javascript courseware suitable for self-study. Most of what I've found assumes no programming experience and is too basic and not really usable for building skills to a professional level. I'm already proficient in OO languages such as C++ as well as being...
  42. TheDemx27

    Java Javascript Setup: What am I doing Wrong?

    I should be able to figure this out myself, I know. All it will display is text in html: It won't run any js. I am completely new to any sort of web programming and I've been searching the interwebs for hours. I'm using mongoose as my web server, and sublime 2 as my text editor...
  43. J

    Java Javascript squareroot algorithm and machine epsilon

    So I made a little application to show the steps of approximating a squareroot using the Babylonian Method: http://jaminweb.com/squarerootCalc.html It's not working all the time. When I do the squareroot of 25 starting with an initial guess of 3.1, it works: Applying...
  44. iamjon.smith

    Comp Sci Getting VALID range of Excel Cells in javascript

    Mod note: The OP has found an answer to his question. I am validating a text field in javascript in EXTJS 4 framework, based on the selected value of a text box: else if (record.get("type") === "CELL_VALUE" && record.get("apply_before") === true) { Ext.Msg.alert("Field Validation"...
  45. D

    HTML/CSS Getting Started with JavaScript and HTML for Website Development

    Does anyone know anything about JavaScript and/or HTML? I'm just really interested but I don't know where to start... If you are asking what for, then I want to learn to develop my own website or social network... (The social network doesn't have to be like Facebook, just for my own purposes...
  46. Jameson

    Java Can adding automatic Latex rendering improve MHB discussions?

    Hi gang. I am trying to test out how adding automatic rendering of Latex would possibly benefit MHB. This requires a few javascript functions from what I can gather so far, but I just don't have the experience with JS. If anyone feels like he or she might be able to help, please reply here or...
  47. S

    Java Javascript Guide: Recommended Resources for Experienced Programmers

    Any recommendations for some Javascript guide? For someone who already knows how to program. Thanks!
  48. B0b-A

    Java Is JavaScript encryption still secure ?

    JavaScrypt is an encryption program [ 256AES ?] released in 2005 ... http://www.fourmilab.ch/javascrypt/javascrypt.html Is this still a secure method of encryption ? , an example of an encrypted messages is below, [ the key is a 64 character hexadecimal number ] ##### Encrypted...
  49. N

    Java Solve Javascript Problem: 2 Dropdowns Menus

    Hello! I am a newbie in javascript programming. I am trying to write a program where there will be 2 drop-down menu, one for month and another for days. There will be no content in the day 'select' tag at first but when a month will be selected from the month drop-down box, day drop-down will...
  50. J

    HTML/CSS HTML5 and Javascript file handling

    I am quite new to the JavaScript and HTML5 world, and I am having trouble with some code that I was hacking together (based on demo's from other people). I am trying to take a file as input (a binary image) and base64 encode it. I think I have the right function for the base64 encoding, I...
Back
Top