GetelementbyId function seems that is not displaying anything [duplicate] - javascript

This question already has answers here:
JQuery - $ is not defined
(36 answers)
ReferenceError: $ is not defined
(7 answers)
Uncaught ReferenceError: $ is not defined?
(40 answers)
Closed 3 days ago.
i cannot make the year show.
Posted here:
https://jsfiddle.net/usge84vo/
HTML:
<footer>© copyright, <span id="year"></span></footer>
JS:
$(function(){
const d = new Date();
document.getElementById("year").innerHTML = d.getFullYear();
});
Thank you!

Related

javascript html pass variable [duplicate]

This question already has answers here:
What is the difference between client-side and server-side programming?
(3 answers)
Why does jQuery or a DOM method such as getElementById not find the element?
(6 answers)
Closed 17 days ago.
I have this piece of code:
<script>
const timesFromCombobox = document.getElementById("cas");
timesFromCombobox.addEventListener('change', timesTracker);
function timesTracker(){
console.log("val: " + timesFromCombobox.value)
console.log(<?= getDataFromSheetByRow(timesFromCombobox.value, 'z_data'); ?> )
}
</script>
but when refreshing page I get this error: ReferenceError: timesFromCombobox is not defined. How to pass reference to the function?

using console?.log(69) instead console.log(69) not getting any error why? [duplicate]

This question already has answers here:
Question mark after parameter as in obj.val?.prop [duplicate]
(3 answers)
Null-safe property access (and conditional assignment) in ES6/2015
(11 answers)
Closed 1 year ago.
After running console.log(69) and console?.log(69) getting 69 as output. What is use of '?' ?

How is this string as a function argument working (no parentheses?!)? [duplicate]

This question already has answers here:
Backticks (`…`) calling a function in JavaScript
(3 answers)
Closed 1 year ago.
Is this a new way to call a function? Whats this even called? Why do this?
const foo = a => console.log(a)
const k = foo`stuff here?` //whaaaaaaa
//output is ["stuff here?"]
they are called tagged template functions. You can read more on how they work and what they do here: MDN

Why does. this arrow function not return an error? [duplicate]

This question already has answers here:
Value returned by the assignment
(5 answers)
Declaring variables without var keyword
(8 answers)
Closed 2 years ago.
In this function the cm variable has no data type eg var const or let. How does it still work without giving me an error?
const inchToCm = inch => cm = inch * 2.54;
Is it because it used an implicit return?

What does require('module')(parameter); mean? [duplicate]

This question already has answers here:
What does double parentheses mean in a require
(3 answers)
Closed 7 years ago.
In Node.js what does what does var module = require('module')(parameter); mean?
Is it the same as:
var module = require('module');
mod = module(parameter);
This is the same as :
var mod = require('module'),
module = mod(parameter);
That's just mean that require('module') returns a function. require(...) can returns anything, it can be an object, a string, a function, anything.

Categories

Resources