221 Answered Questions for the topic javascript

06/19/19

Why does 2 && 3 results in 3 (javascript)?

When I type in browser's console: console.log(2 && 3) it results always with second number (in this case 3): 3 Can someone explain me why?
Javascript Logic

06/19/19

Can !a!=!!b^!!-!a||!+!a|!c return anything other than 1?

I was playing the Javascript game with somebody and we were having fun making ridiculous and absurd expressions to make our inputs get a particular output. This little charming one ... more

06/06/19

Is window really global in Javascript?

Take this piece of Javascript in a browser: <script> console.log(window.someThing); var x = 12; function foo() { window.otherThing = x; } </script>Inside... more

06/05/19

Why does closing a window in Indesign doesn't work?

I have a question concerning Indesign script. Why does it work, when you close a window like: submitButton.onClick = function(){ close(); } But when I try to execute a function afterwards... more

06/04/19

add property to object?

With Indesign scripting, why can't I add properties to an object? I get an error > Object does not support the property or method 'foo' items = b.items(b.layer("s_labels")); for (var i =... more
Javascript

06/03/19

Explain what is Javascript? List some data types supported by Javascript?

Javascript

05/30/19

Simplest way to plot points randomly inside a circle?

I want to have random points plotted inside a circle, but I do not know how to limit the points to be inside the circle. Given a circle of a certain size and position, how would I go about... more
Javascript

05/28/19

javascript slider weighted values?

I have a JavaScript slider that outputs a value between 0 and 1 depending on its position. I want to convert that value to a value on another scale between say 100 and 1000, but based on the... more
Javascript

05/23/19

Which large websites use D3.js?

Javascript

05/22/19

filling circle with hexagons?

I'm trying to find a way to put as much hexagons in a circle as possible. So far the best result I have obtained is by generating hexagons from the center outward in a circular shape. Using... more
Javascript

05/22/19

How would one create a triangle container for an image (x-browser)?

How would I create a DIV containing an IMG where the DIV cuts the image into a triangle, thereby displaying only part of the image though a triangle. So... ``` <div> <img... more
Javascript

05/22/19

2D game algorithm to calculate a bullet's needed speed to hit target?

I have a rather simple bird's-view 2D game where tower sprites defend against incoming moving sprites by shooting a bullet at them. My question: How do I calculate the needed bullet speed for the... more
Javascript Autocad Cad Three.js

05/22/19

Javascript/canvas renderer for CAD/AutoCAD files?

Does anyone know if there's a parser for autocad/cad formatted files in javascript? Or perhaps something server side which can translate cad files to collada so that three.js (and some of the other... more
Javascript Web Design Angular Js

05/21/19

What are the benefits of react?

Javascript

05/16/19

Does d3 use jQuery?

Javascript

05/14/19

How to solve the issue of round number in JavaScript?

I am having an issue in which if I am entering 9 sixteen times and formatting it using `Math.round(9999999999999999)` and it is becoming `10000000000000000`. Oddly enough, when I run... more

05/13/19

Run event listener only once after saving InDesign document?

I have a script _(that I did not write)_ that has a `app.addEventListener('afterOpen', addVariables);` event in it (addVariables being the name of the function). I altered it to be... more
Javascript

05/12/19

Determine if a point is inside a triangle formed by 3 points with given latitude/longitude?

I have 3 points (lat, lon) that form a triangle. Using javascript, how can I find if a point is inside this triangle?
Javascript

05/08/19

calculate straight line declining?

i have asset (say vehicle) with value of 1000 in this year... var assetCurrentBookValue = 1000 vehicle will depreciate within 5 years... that means the value will become 0 in the next 5... more
Javascript Logic Parsing

05/06/19

Why does javascript accept commas in if statements?

I stumbled across some javascript syntax that seemed like it should produce a parse error of some kind but doesn't: if (true, true) {console.log('splendid')} else {console.log('horrid')} //... more

05/06/19

Regex defined outside of for loop not working?

Long time user, first time asker; very new to regular expressions. I'm a designer trying to make my life in InDesign easier, so please be patient if this is an easy one :) I'm working on a script... more

05/06/19

Remove items from one array if not in the second array?

I state that I have tried for a long time before writing this post. For an InDesign script, I'm working with two array of ListItems. Now I'm trying to remove the items of one array that aren't in... more
Javascript Web Design

05/06/19

Why is JavaScript useful for front end developers?

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.