Questions tagged [javascript]

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Use this tag for questions regarding common implementations of ECMAScript, JavaScript, JScript, etc. JS does not typically refer to its ECMA-cousin, ActionScript.

Filter by
Sorted by
Tagged with
12
votes
2answers
1k views

Functional reactive programming — is Fay expressive enough?

So I'm doing a fairly involved javascript/html client with lots of ajax calls and other involvements of callback-ism. I'm entertaining the thought of using Fay for this purpose. I'm aware of Elm. ...
12
votes
3answers
779 views

Why can we delete some built-in properties of global object?

I'm reading es5 these days and find that [[configurable]] attribute in some built-in properties of global object is set to true which means we can delete these properties. For example: the join ...
12
votes
1answer
2k views

Patterns for ajax-heavy web applications

Up until now, I've been a great fan of the MVC pattern for developing web applications. For the web, I've developed mostly in PHP (with the Kohana and CodeIgniter frameworks) and Ruby (RoR). As my ...
11
votes
14answers
1k views

Should I worry about 'Javascript piracy'?

If I write a client-side Javascript app (with a little bit of server interaction), how can I prevent people from copying the Javascript files to their own site? Should I, at all?
11
votes
3answers
570 views

How can I prevent a user from editing my code in their browser?

Description I'm designing a Node.JS application (more like a full website). The app will send five JavaScript files and will have <script> tags linking them together. Question How can I ...
11
votes
6answers
6k views

Web Developer and Math [duplicate]

I have just learned HTML/CSS and I practice everything I read to make it more understandable to me and I really enjoy it. My goal is to be a Modern Web Developer both front and back-end, so I won't ...
11
votes
5answers
2k views

Compute if a function is pure

As per Wikipedia: In computer programming, a function may be described as pure if both these statements about the function hold: The function always evaluates the same result value given the same ...
11
votes
5answers
6k views

When a task can be accomplished by either Javascript or CSS, is it better to use CSS? [closed]

I always veto JavaScript by using CSS as much as possible. i.e. I create tabs and rollover buttons using CSS rather than JavaScript. I have seen some solutions—specifically the Wt web-framework—...
11
votes
4answers
5k views

What exactly undefined means in JavaScript? Why it's there? What usages it has? How it could be useful?

In JavaScript, we have something called undefined. I said something, because I really don't know if it's a base class, or a built-in variable, or a keyword, or anything else. I just know that it's ...
11
votes
2answers
7k views

What is an Activation object in JavaScript?

In a given execution context, the Variable object is the Activation object of that execution context. From my research online, I am able to find the previous sentence rephrased in different ways but ...
11
votes
3answers
1k views

JavaScript and the paradigm shift in web programming

If my memory serves me right, there was a time when using JavaScript for web development was hugely frowned upon, because among other things, it was a privacy and security concern for users and some ...
11
votes
4answers
5k views

Should I invest time learning Coffeescript? [closed]

I am a freelancer and I earn my bread and butter by helping others write better java-script code. I have good experience with most of the JavaScript frameworks around. I am wondering if it is worth ...
11
votes
6answers
4k views

How can I write HTML, CSS, and JavaScript to make back-end developers work easier?

When I get a design from a designer, I get it as a PSD (Photoshop) file. I always expect proper layer and folder names, basically a clean and managed PSD. From this desigbn I develop HTML, CSS and ...
11
votes
5answers
3k views

What are you thoughts on GWT? [closed]

Since I'm learning Java in this period and I just finished with the tutorials I think I'm ready to start contributing to a project (since I know from experience this is the best way to really learn). ...
11
votes
4answers
4k views

Are there any limitations of an idealistic HTML5 web application

Let's assume the following two assumptions are true. Your entire userbase has broadband access everywhere There is an imaginary browser X that implements the entire draft specification of the HTML5 ...
11
votes
2answers
4k views

Fundamental Difference between fn() and new fn() in javascript

In what all aspects, calling a function with and without new keyword differ in javascript? I mean what all things are differing between? testFn() vs new testFn()
11
votes
3answers
1k views

How do you use duck typing in javascript without always checking for properties and methods?

I know javascript uses duck typing and at first I thought this would make polymorphism easy compared to strongly typed languages like C#. But now my functions that take arguments are littered with ...
11
votes
4answers
795 views

How does the GPL work in regards to languages like Dart which compile to other languages?

Google's Dart language is not supported by any Web Browsers other than a special build of Chromium known as Dartium. To use Dart for production code you need to run it through a Dart->JavaScript ...
11
votes
3answers
1k views

How is type checked in a dynamic language interpreter/compiler, such as JavaScript?

In dynamic languages, such as JavaScript or Python, the type of a variable is determined at runtime. This is one reason why they are slower than typed languages such as Java. How is type checking ...
11
votes
4answers
21k views

Which Java based web ui framework to use? [closed]

Wicket Click GWT Vaadin As I understand them, these frameworks all enable gui components to be created using java (with all its benefits) without having to do lots of html/javascript. As well as ...
11
votes
3answers
2k views

Should I nest functions in languages that allow me to do that or should I rather avoid it?

In JavaScript, PL/SQL and some other languages, functions can be nested, i.e. declared within another function. This could be used to break a large function into smaller pieces, but keep those pieces ...
11
votes
2answers
1k views

How can I use my coding skills for good?

By this autumn my two small websites should be generating around a total of $1200 a month with minimal/zero input which is enough to for me to live on comfortably enough. Rather than embark on ...
11
votes
3answers
3k views

Are there open-source JavaScript libraries addressing multiple browser tabs and client state for newer browsers? [closed]

There are a few new HTML5 features that have made it into recent browsers that allow sharing state among tabs, browser windows, same domain windows, etc. So it's probably gotten a little easier to ...
11
votes
2answers
436 views

How do mashups work with same-orgin policy?

If Javascript is only allowed to access scripts from the same domain, how can a website create mashups which must read and modify content from another domain?
11
votes
2answers
3k views

What are my choices for server side sandboxed scripting? [closed]

I'm building a public website where users share data and scripts to run over some data. The scripts are run serverside in some sort of sandbox without other interaction this cycle: my Perl program ...
11
votes
2answers
5k views

How to modularize and package a client-side Javascript library today?

I've been catching up with the modern client-side JS ecosystem and reading up on CommonJS and AMD (incl. associated tools - browserify, requirejs, onejs, jam, dozens of others). If I'm writing a ...
10
votes
7answers
16k views

Is it necessary to memorize code?

I am a new developer, who just got hired at a big company. I don't know how but I guess they are desperate. However, I am well-versed with HTML5/CSS3 though things change and new things are released ...
10
votes
11answers
15k views

Do I have to learn html and javascript to create web applications? [closed]

I am an experienced Java programmer, and I want to create a complex web application requiring dynamic pages, drawings, etc (take SO as an example). Do I have to learn javascript/html in order to ...
10
votes
8answers
4k views

Rush to client-side in web development

In the past few months, I recognized a big excitement about client-side scripting in web development. But while server-side technologies are mature, stable and well accepted by backend-developers, ...
10
votes
5answers
1k views

Is it beneficial to study past the basics of a core language when the primary goal is to rely on its framework? [closed]

Please keep in mind this is not another 'How much [insert programming language here] should I know before moving onto [insert framework here]?' What I'd like to know is how beneficial is it to learn ...
10
votes
5answers
77k views

Falsy values vs null, undefined, or empty string

I've worked with jQuery over the years. However, recently, I've found myself getting deeper into the JavaScript language. Recently, I've heard about "truthy" and falsey values. However, I don't fully ...
10
votes
3answers
5k views

When and Where should we use hoisting in Javascript [closed]

I'm new to Javascript. I'm learning the concept of hoisting in Javascript. Based on the Javacsript tutorials in Mozilla website, I came across this word hoisting. According to those tutorials, ...
10
votes
5answers
942 views

How can I actually apply the javascript I am learning [closed]

I am a front end programmer. I'm good with design, html, css, and jquery, but I want to learn javascript more than anything. I've taken a couple of courses, read books and tutorials online and feel ...
10
votes
3answers
1k views

What is the point of the prototype method?

I am reading through Javascript: The Good Parts, and struggled to get my head around the section on prototypes. After a little google, I came to the conclusion that it is to add properties to objects ...
10
votes
3answers
12k views

Is it bad practice to use hyphens in JSON keys?

I see a lot of questions revolving around accessing JSON keys that use hyphens (kebab-case), but now I find myself wondering should I just stick to camelCase or snake_case in my keys. I know hyphens ...
10
votes
4answers
3k views

Should I parse XML on the server or provide a proxy and let the browser parse it?

I need to interface with a 3rd party API. With this API I make a GET request from within the end user's browser and receive an XML response. This data is to be used in a browser based application ...
10
votes
4answers
17k views

Is node.js a good fit for background processing?

I'm slowly learning node.js and have a small project I want to start. The project will have a lot of background processes (downloading data from external sites, parsing CSV files, etc.). A big "win" ...
10
votes
4answers
597 views

Has the time gone to think about user with JavaScript disabled in browser? [duplicate]

Possible Duplicate: Should I Bother To Develop for JavaScript Disabled? In this Modern time of HTML5 API jQuery Modernizr HTML5 Shim Respond.JS Google Chrome app store Canvas Has the time gone ...
10
votes
4answers
11k views

What is the advantage of assigning a function to a var?

Given this Javascript example I found var sum = function() { var i, sum = 0; for(i = 0; i < arguments.length; i += 1) { sum += arguments[i]; } return sum; }; What advantage is there ...
10
votes
4answers
7k views

JavaScript Multi Threading

Well these days JavaScript is main player in all web development technologies , on client side for making user interface better, client side logic, on some web servers as server side logic also Add ...
10
votes
3answers
7k views

why getMonth() starts with 0

I was coding a function to remove a day from a date value in javascript and i was kind of surprise that javascript's getMonth() starts from 0 for January to 11 for December. Why javascript's getMonth(...
10
votes
1answer
496 views

Why most anonymous functions can't be JIT compiled and will never be optimized?

I just read https://techfindings.one/archives/2652 about functional programming and came accross this: anonymous functions can often not be JIT compiled and will never be optimized Can someone ...
10
votes
6answers
2k views

Common Javascript mistakes that severely affect performance? [closed]

At a recent UI/UX MeetUp that I attended, I gave some feedback on a website that used Javascript (jQuery) for its interaction and UI - it was fairly simple animations and manipulation, but the ...
10
votes
4answers
6k views

Where to master HTML, CSS and Javascript? [duplicate]

Possible Duplicate: What should a developer know before building a public web site? I gotten interested in web-development lately. I am still a student. I learnt basics of HTML, CSS and ...
10
votes
2answers
1k views

Why is the use of constructors discouraged when creating prototypes?

Quick background: In JavaScript, the constructor function for each object type has a prototype property. The prototype refers to an object that each constructed object uses as the next step up in its ...
10
votes
4answers
3k views

How do you keep code with continuations/callbacks readable?

Summary: Are there some well-established best-practice patterns that I can follow to keep my code readable in spite of using asynchronous code and callbacks? I'm using a JavaScript library that does ...
10
votes
3answers
550 views

What does it mean to inject data (vs behaviour) in a class constructor, and why is that considered bad practice?

I am reading the book "Learning TypeScript" by Remo Jansen. In one section the author describes how to create a very simple proof-of-concept MVC framework including how to create the Model class and ...
10
votes
1answer
3k views

Prevent Click Fraud in Advertisement system with PHP and Javascript

I would like to build an Advertising project with PHP, MySQL, and Javascript. I am talking about something like... Google Adsense BuySellAds.com Any other advertising platform My question is mainly,...
10
votes
2answers
548 views

How do you unit test your javascript

I spend a lot of time working in javascript of late. I have not found a way that seems to work well for testing javascript. This in the past hasn't been a problem for me since most of the websites I ...
10
votes
1answer
442 views

Building a computer system with JS? [closed]

I recently finished this book called The Elements of Computing Systems where you build a working computer system from the ground up, starting from basic logic gates, to creating your own machine code ...