convert Java to javascript code [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Someone can help me,i have stuck here,i have code java like this:
List<Object> lstObject = new ArrayList<>();
Object o = lstObject.get(0);
and now im confiuse how to change in the code javascript.
i hope some one can answer my question,and explain the logic.
thanks,

declaring a new empty array
var lstObject = [];
access the array
var o = listObject[0];
These are the basics of JS. Please read about
JavaScript Arrays

Related

is it okay to write javascript code in angular [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Hi I have a general question is it okay to write JavaScript code in angular (in my case for dom manipulation)
Here is an example of what i would use.
Thanks in Advance.
document.querySelectorAll('div.links a').forEach(function(item) {
const tag = window.location.href.indexOf('content') > -1 ? 'hello' : 'hai';
const href = `${item.getAttribute('href')}${brand}`;
item.setAttribute('href', href);
});
You should access to dom elements using angular properties such as ElementRef/ViewChild like it says on the answer here:
Access to dom elements

Came across a javascript code, which I can't read [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I came across this java script code and I don't know how I encode it. Here is a part of it:
var _0x6ah4=['a22uo1w=','a2VlcC1h2ZQ==','YMA0aG9y8XVlML==','Z3cCwgZGVmHBbG0ZQ==','Qk1OQ04=','enNHYAM=','P0ASTmI=','RkVPOE9=','Y2AQUEc=']
Can somebody tell me how to convert this into readable code?
var _0x6ah4=['a22uo1w=','a2VlcC1h2ZQ==','YMA0aG9y8XVlML==','Z3cCwgZGVmHBbG0ZQ==','Qk1OQ04=','enNHYAM=','P0ASTmI=','RkVPOE9=','Y2AQUEc=']
Its simple.
variable name _0x6ah4 ,
its an array containing 9 elements.
You can fetch the data using foreach, if you want.
var _0x6ah4=['a22uo1w=','a2VlcC1h2ZQ==','YMA0aG9y8XVlML==','Z3cCwgZGVmHBbG0ZQ==','Qk1OQ04=','enNHYAM=','P0ASTmI=','RkVPOE9=','Y2AQUEc='];
for (var line=1; line<_0x6ah4.length; line++) {
console.log(_0x6ah4[line]);
//if you need to decode , do it here
}

Change coding in java script function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have never seen it, but is there a way to modify the existing java script function through the code? Something similar to "ALTER PROCEDURE..." statement in SQL Server?
Thank you!
You can replace any function in Javascript simply by assigning a new function to it, they're merely object properties or simple variables:
Math.max = function () {
return Math.random(); // har har har
};
You cannot trivially "reach into" a function and change something about its internals though, no. Or at least, that would be pretty insane.

Regular expression start and end with word [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
The below code is full of string. I want to select cbUserURLs array variable.
var someurl =new Array('a','b');
var cbUserURLs =new Array('url1','url2',...);
.. //some code
What is the regular expression should I use here?
You just need use cbUserURLs.*\); if what you want is

How do I use a var to access json object property [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
So here's a little test I'm doing to check if I'm grabbing all the thumbs from my object. Problem is projectName is coming up undefined. Whhhhaaa?
var projectName = $(this).attr("href");
console.log(worklist.work.projectName.thumbs.length);
If you need to access a property dynamically, use bracket-notation.
console.log(worklist.work[projectName].thumbs.length);
try
console.log(worklist.work[projectName].thumbs.length);

Categories

Resources