function js
function myFunction(){ document.write("Hello World!") } myFunction();
Here is what the above code is Doing:
1. We create a function called myFunction.
2. We call the function.
3. The function outputs “Hello World!”.
function myFunction(){ document.write("Hello World!") } myFunction();
Here is what the above code is Doing:
1. We create a function called myFunction.
2. We call the function.
3. The function outputs “Hello World!”.
# .env files API_URL=https://myapi.com GOOGLE_MAPS_API_KEY=abcdefgh # use env import Config from ‘react-native-config’ Config.API_URL // ‘https://myapi.com’ Config.GOOGLE_MAPS_API_KEY // ‘abcdefgh’ # call env development: ENVFILE=.env.staging react-native run-android production: cd android && ENVFILE=.env.production ./gradlew assembleRelease Here is what the above code is Doing: 1. Create a .env file in the root of your project. 2. Add your environment…
I had this problem when I was importing the page (component) rather than the module, and it wasn’t giving any compilation errors but then module not known at runtime. In your app.module.ts put your module in the imports list. Here is what the above code is Doing: 1. We import the NgModule decorator function. 2….
var div = document.createElement(‘div’); div.innerHTML = post_body; var firstImage = div.getElementsByTagName(‘img’)[0] var imgSrc = firstImage ? firstImage.src : “”; // or, if you want the unresolved src, as it appears in the original HTML: var rawImgSrc = firstImage ? firstImage.getAttribute(“src”) : “”; Here is what the above code is Doing: 1. Create a new div…
const styles = makeStyles((theme: Theme) => ({ container: { display: ‘flex’, flexWrap: ‘wrap’ }, spacious: { // class name padding: 10 }, })); const classes = useStyles(); // use it Here is what the above code is Doing: 1. We’re creating a new class called `spacious` that adds 10px of padding to the `container` class….
var els = document.getElementsByClassName(“myClass”); for(var i = 0; i < els.length; i++) { console.log(els[i]); } Here is what the above code is Doing: 1. We get all the elements with the class name "myClass" and store them in a variable called els. 2. We loop through all the elements in els. 3. We print each...
var filename = location.pathname.substr(location.pathname.lastIndexOf(“/”)+1); Here is what the above code is Doing: 1. It’s creating a variable called filename and setting it equal to the name of the current file. 2. It’s creating a variable called filepath and setting it equal to the path of the current file. 3. It’s creating a variable called filepath_no_ext…