How to encode URL in JS?

Small tutorial with code examples about how to encode URL in JavaScript safely
31 October 2017   2800

For example, you have and URL that need to be encoded safely using JavaScript such way such that it can be put into a GET string.

var myUrl = "http://example.com/index.html?param=1&anotherParam=2";
var myOtherUrl = "http://example.com/index.html?url=" + myUrl;

Use the built-in function encodeURIComponent(str) and encodeURI(str)

var myOtherUrl = 
       "http://example.com/index.html?url=" + encodeURIComponent(myUrl);

Frontend News Digest 21 - 26.07

Let's check what's going on in field of frontend programming this week - JavaScript, Node.js, PHP, React Native, etc
26 July 2019   467

Greetings! I hope your week went great! Here's new Frontend news digest.

The biggest news of last week is a released of the new version of Node.js - v12.7. Additionally, have prepared some interesting guides for you, that incluces basics of React Native and practical advice on how to improve your JS code.

Guides

  • The Fundamentals of React

An evergreen, one-stop-shop introductory guide to React that covers all of the fundamental concepts you need to know.

  • Practical Ways to Write Better JavaScript

You’re not necessarily going to agree with all of them but this is a reasonably solid batch of points to think about overall.

  • Creating WordPress Forms That Get Filled In

In this article, author will give you some tips on adding forms to your website that actually get filled in.

  • The Basics of Going 'Multithreaded' with Node 

Using the new worker_threads module — an amazing solution when you need to perform a CPU intensive task.

Articles

  • What's New in PHP 7.4

PHP 7.4 will be released on November 28, 2019 and here are some highlights of new features and changes.

What Makes Laravel Development A Preferred PHP Framework for Web Developers?

According to the developers, Laravel framework makes website development easier.

Updates

  • Node v12.7 (Current) Released 

Another version bump for perhaps the most exciting release line of Node.

  • Jay: A 'Supercharged' JavaScript REPL

An interesting alternative to Node’s built-in REPL that adds features like loading modules directly from the npm registry, eager evaluation, colored input, bracket completion, typeahead completion and more.

  • json-complete: A JSON Alternative That Retains References, Handles Circular Dependencies, and More 

Provides an interesting way to encode and store state and supports ‘almost every data type’ available in JavaScript.

  • Vuetify 2.0 Released: A Material Component Framework for Vue.js

A framework that provides clean, reusable components for Vue apps that adhere to Google Material Design principles.

Podcast

  • On the New Awesomeness Coming in Vue.js 3.0 

An hour long chat with Vue.js core team member Chris Fritz on what’s coming in the next major version of Vue.

  • Laravel News Podcast LN87 -  Subscribable Notifications, Repeater Fields and Laracon US

Jake (web dev designer) and Michael (PHPAdelaide co-organiser) discuss all the latest Laravel releases, tutorials and happenings in the community.