Questions tagged as 'javascript'

3
answers

How to decompose a number in powers of 2

I'm using javascript for my logic: I have a sequence of numbers: 1, 2, 4, 8, 16, 32 and so on. Given a number, which must be the sum of sequence numbers, for example: 44 (of which the value is the sum of 4 + 8 + 32). How do I know that the nu...
asked by 11.07.2014 / 18:54
4
answers

How to delete an item from an array by attribute value?

I have the following array with some items: var arr = [ {id: 1, name: "Jon Snow"}, {id: 2, name: "Michael Scolfield"}, {id: 3, name: "Dexter Morgan"} ]; To add a new item, the push method is used. Exactly this way:...
asked by 02.06.2017 / 16:55
2
answers

How to validate fixed and mobile phone number jQuery Validator?

I need a cell phone and landline validation method with the jQuery Validator plug-in. Differentiation of fixed-to-mobile numbers is important in order to validate the sending of SMS.     
asked by 07.05.2014 / 22:29
1
answer

Is it possible to create applications for Android using HTML5?

I really wanted to start developing applications for Android phones, but I have almost no knowledge about the operating system SDK, I have more knowledge about HTML, Javascript, CSS. I have in mind that creating an Android app should be well...
asked by 15.04.2014 / 04:28
2
answers

Which improves performance: use "async" or put script at the bottom of the page?

It is often cited as good practice for performance: Put tags <script></script> at the bottom of the page, before </body> Use async: <script async="async" src="..." ></script> Which of t...
asked by 02.06.2014 / 18:02
2
answers

How do you read comma sentences in JavaScript?

Today I was testing minify my code and I was in doubt about the conversion. Original Code Loader = (function(Configure){ var CurrentAction = null; var loaded = []; loader = function(){} loader.prototype = { chec...
asked by 20.07.2016 / 16:34
1
answer

What is the difference between KnockoutJS and AngularJS / EmberJS?

What's the difference between KnockoutJS and AngularJS / a href="http://emberjs.com/"> EmberJS ? From what I've been researching: Apparently KnockoutJS has a much smaller learning curve, can be integrated into existing static sites and...
asked by 11.07.2014 / 13:12
4
answers

Detect Line Break

I have the following function: if (str.match(/\d\d\d\d\d\.\d\d\d\d\d/)) { var codigo_velho = str.match(/\d\d\d\d\d\.\d\d\d\d\d\/); result = "1"; } How do I change this function so that it detects line break in match ? For ex...
asked by 26.05.2014 / 04:34
4
answers

Check if a string is only composed of 0

I want to check if for example a string "00000000" is only zeros and give true, however a "0000a0e0b" is false, why I tried with! isNaN and gives true having at least 1 number var palavra = 00000; var palavra2 = a00a0; if(!isNaN(palavra)) // A...
asked by 17.06.2018 / 23:13
7
answers

How to create masks in input with JavaScript? [duplicate]

I need to create a mask for a phone input with JavaScript only (I can not use jQuery). How can I do it?     
asked by 12.02.2014 / 17:28