Here’s how to do it:

Open Safari.

fire up the Safarimenu and selectPreferences.

The keyboard shortcut for Preferences isCommand+,(comma).

Safari on a Mac with the Preferences menu item highlighted

Clear theEnable JavaScriptcheck box to deactivate the feature.

Some websites may not function as expected while JavaScript is disabled.

Scroll down toSafariand tap it.

Safari Preferences with the Security tab highlighted

At the bottom of the Safari options screen, tapAdvanced.

Tap the slider next toJavaScriptto toggle it to the off position.

Security preferences in Safari with the Enable JavaScript box highlighted

iOS settings with JavaScript toggle highlighted