Questions tagged as 'ecmascript-5'

1
answer

How to make Visual Studio recognize the 'use strict' directive?

Apparently Visual Studio does not recognize the 'use strict' directive, because I typed the code below that assigns a value to a variable that was not declared (something prohibited in strict mode ) and there was no part of IntelliSense....
asked by 04.01.2014 / 18:10
1
answer

Doubt with JavaScript arrow function

In the code below, the showName() method will of course return undefined , as it will fetch a name property in the scope where the obj is inserted. My question is, in that case would I have to use a conventional function, the ar...
asked by 01.06.2017 / 22:23
1
answer

Doubt over assignment of variables in Ecmascript 5

My question is related to the behavior of a variable, since it is assigned a dynamic value in it. For example in the code: var x_position = window.getComputedStyle(elemento).marginLeft; Doubt: Every time I have to read the variable...
asked by 30.09.2017 / 23:01
2
answers

AJAX and WeakMaps requests

While I was putting into practice what I have learned so far about the ES2015 with Babel. specifically on WeakMaps, I came up with a problem that I do not know why it happens and I do not know how to solve it. I have a WeakMap set to store in...
asked by 26.01.2017 / 11:36
2
answers

Call function out of scope in javascript

Follow the code to explain my error: class Cliente { showName(name) { alert(name) } getName(){ $.get(minha-url) .done(function(data) { this.showName(data.name) }) } } The getName method returns an error because it does not fi...
asked by 03.01.2017 / 19:23
2
answers

Use the number of characters obtained in a regular expression sentence in the string substitution

I'm doing a Markdown parser as part of a regular expression study, and I'd like to use the amount of characters in a stretch of the expression as a basis for string substitution, for example: # Titulo ## Titulo The first title will be added...
asked by 20.08.2015 / 19:38
0
answers

Send post parameter to restify

I'm trying to send parameter to nodejs with restify, but it's always getting undefined I'm sending more or less like this: $.ajax({ url : 'http://localhost:8080/api', type: 'post', dataType: 'json', data:...
asked by 20.07.2018 / 20:52
4
answers

Check index in array of objects by property

When I click on an element, I get an id. With this I go into an array and find out which object has the same id, and I need to remove all objects with the same id. function onRemove(city) { for (var i = 0; i < array.length; i++) {...
asked by 10.04.2018 / 13:49
1
answer

How to structure the parameters in a javascript object

I have the following code: var colHeaders = [ "Column 1", "Column 2" ]; var columns = [ {data: 'column_1', validator: validatorRentalCode, allowEmpty: false, allowInvalid: false}, {data: 'column_2', type: 'numeric', numericFo...
asked by 12.09.2018 / 16:16
1
answer

How to remove the first key that surrounds all the values of a JSON

Is it possible to remove the first key { } from a JSON and add in lines below (Enter), of each value? var obj = { "arvore": "/", "avo": "obadias", "pai": { "eu": "Leonardo" } } class Access { static getRaiz...
asked by 14.10.2017 / 02:41