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
-2
votes
1answer
660 views

Add method to existing class you don't own in javascript

Is it still called monkey patching if you are only adding new methods instead of changing existing method behavior? What is this called? Example: String.prototype.contains = function(needle) { ...
-2
votes
2answers
195 views

How to find all occurrences of a variable within a source code?

The title is pretty self-explanatory. I have a minified JavaScript code (100k+ lines) and would like to find all occurrences of a particular variable so I could rename it to better understand code. Is ...
-2
votes
1answer
91 views

Deleting dynamic elements from a database [closed]

I have a select dropdown, with '+' and '-' buttons that add and remove items before submission. I would like to be able to remove the elements with the '-' button after they have been added to the ...
-3
votes
2answers
474 views

Are Java and JavaScript converging? [closed]

It seems to me that Java was the computing language that could be used anywhere and JavaScript was the scripting language for the web and things stayed that way for a long while. There are countless ...
-3
votes
1answer
445 views

Why is the JavaScript-language different in different programs/sites? [closed]

I'm kind of new to programming and i have a question that's been bothering me for awhile. Why is the JavaScript-language different in different programs/sites. I've used Codecademy to practice and i'...
-3
votes
3answers
2k views

why is remainder of division, multiplied by divisor ? using operator %

I have started to learn Javascript. From book http://eloquentjavascript.net: There is one more arithmetic operator which is probably less familiar to you. The % symbol is used to represent the ...
-3
votes
4answers
279 views

Might there be two types of a “callback” in programming? [closed]

I know two definitions for a "Callback": A function that is being called-after ("called-back when") a certain event is triggered. A function that is passed to another function as a parameter. An ...
-3
votes
2answers
211 views

Is this an anti pattern in Javascript?

A common pattern I've been using for JS/NodeJS applications is the following: import { utility1, utility2 } function exampleScript() { utility1() utility2() // Does something } Basically my main ...
-3
votes
1answer
545 views

Why does an expression for a Javascript function that returns void still execute? [closed]

I'm so confused about how Void operator (in javascript) works and what is it's role. as i read, Void is an operator that evaluate an expression without returning a value, but by executing that script ...
-3
votes
1answer
1k views

Dictionary representation of an object

As python memory model is dictionaries of dictionaries, looks like any object in JavaScript has similar representation. Below code, > foo = {} makes foo as an empty dictionary {}. fine. If code ...
-3
votes
1answer
74 views

How compiler and interpreter both are used in one language? [closed]

After writing the complete code the compiler compile the whole code at a time , but on the other hand interpreter take single line at a time. Both the compiler and interpreter are mostly called the ...
-3
votes
1answer
55 views

How does event.target return the DOM object?

I read through documentation and searched on google, but couldn't find a specific answer. Currently, I have an object that subscribes to a click event. I am trying to understand how a view that ...
-3
votes
1answer
66 views

Creating a multiplatform (IOS, Javascript, and JAVA) linked user account database

I have done weeks researching this question for my App Idea. Background of the APP - Simply a multi crypto currency wallet which users sign up with ONLY username and Password - no email, FB, or ...
-3
votes
1answer
215 views

How to make your JavaScript private? [duplicate]

I wanted to know if there is a way to make your JavaScript private from client side?
-3
votes
1answer
4k views

How can I do to use Angular 5/6 for frontend and Codeigniter 3 for backend in the same web app?

I have this project I want to do, using Angular 5/6 for frontend and Codeigniter 3 for backend. The problem is that I don't know how to combine the two, and all the tutorials I looked were using ...
-3
votes
1answer
56 views

Adding links to posts using RegEx - should it be server side or client side?

I am working on adding a feature to a forum where I look for keywords in posts and add links to these keywords. For example, say a user's post includes the phrase "HP Printers". This phrase would be ...
-3
votes
1answer
284 views

Is it better to have a single, more general directive or multiple type based directives in Angular?

Is it considered good practice to have: Single, general directive that has multiple data-* parameters and serial data is binded from controller Single, general directive that has config and serial ...
-3
votes
1answer
94 views

Is there a best practice for naming class selectors for identification alone

Is there a best practice for naming class selectors for identification alone? For example, for defining a single amount field with action button, we end up creating several div containers and div ...
-3
votes
1answer
47 views

Passing dynamic data to declarative resource load tags in an HTML document?

Is it possible to pass dynamic data to the browser when it automatically GETs link and img and script etc tags after it has parsed the html containing them? Ultimately would want to pass an ...
-3
votes
1answer
1k views

Simple Javascript Validation not working [closed]

I am trying to do the following: HTML Code <body> <form name="myform"> <table> <tr> <td>First Name:</td> <td><...
-4
votes
1answer
156 views

Did GO embrace any language construct introduced in Java?

GO has embraced, 1) JavaScript/Python language constructs, Higher order function Closure Slicing Range operator Anonymous function(inner function) Provides abstractions ...
-4
votes
1answer
92 views

What is the truh concerning pasting data into a browser? [closed]

I am hearing a ton of different info. I just found this in a site The 'paste' operation in the context menu or button press is not possible. It is not possible because of a browser security ...
-4
votes
2answers
2k views

Reliable device/browser/OS detection [closed]

Is there some reliable way to detect device/browser/OS of web page visitors except using the user agent string? This is not for rendering/functionality of the web page/application, but only for ...
-4
votes
1answer
145 views

Rewrite legacy code or continue to live with it [duplicate]

Last year I decided to create a web-based SAP Business One extension system consisting of a JavaScript SPA written with Aurelia that communicates with two REST backends written in Go and Java (...
-4
votes
1answer
875 views

How does the typescript transpile function work

Assume the following: /// file.ts var x = "hello"; x = 1; console.log(x); /// file.ts function transpile(fileName) { ... } What steps would typescript take to transpile the file? How and when ...
-5
votes
5answers
254 views

I learnt a languge suppose (Java). I also know python. I want to write a simple app. Is there any way to run both language same Time?

I had been learning python and i know Java. if i were to write a simple program, can i write both programming language in one document or compiler? I got into this problem because if i cannot merge ...
-5
votes
1answer
5k views

Using forEach on empty array [duplicate]

I have a dynamic array that can often be empty, and I need to iterate over all its elements. So far I have such code: array.forEach(function(item, index) { //stuff here }); It works fine of ...
-5
votes
1answer
140 views

Variables Naming in Javascript and PHP

Is it a good idea to use the same naming nomenclature (e.g. camelCase) for both front end (eg. Javascipt) and backend (eg. php) ?
-5
votes
1answer
785 views

What are the benefits of using Jasmine Framework on existing applications?

I got one project which contains JavaScript code. No unit tests were written for JavaScript code. So it is feasible or beneficial to write unit test cases using Jasmine Framework for code? What are ...
-5
votes
1answer
1k views

How to compare and replace value from two object inside array?

Here i want to replace price in data1 to price from data2, and it updated if the id is same. Is it possible to do that without nested loop? var data1 = [{ "id": "56e641d4864e5b780bb992c6", ...
-6
votes
5answers
13k views

How to not let anyone inspect elements of a webpage?

I was thinking to make some jQuery functions that will use ajax to control mysql. The whole idea is to make separate files of PHP (e.g query.php, addRow.php, update.php and delete.php) provide data to ...
-7
votes
2answers
942 views

Technology like SignalR but client side [closed]

I would like to program a software that will heavily utilize client side development (JavaScript), and I want to communicate with the server. Is there a way similar to SignalR where I can keep ...
-7
votes
2answers
152 views

How do I make such a page that opens different link in web (PC) and different in mobile (phones)?

I am building a website that looks beautiful in Web but worst in mobiles. I want to build the same site but different designing for mobile. Whenever user opens site.com then it auto redirect to m.site....